top of page

REST(API)

"The world will not fall from a mistake - it will fall from indifference to it.”

bugreaper-api_compr.png

Module for interaction with API and mock-server

  • Click <HERE> to see features

  • Example => WIKI-LINK

  • Contains sub-module "MockApi"

Interaction:

sendGet

sendHead

sendOptions

sendPost

sendPost

sendPut

sendPut

sendPatch

sendDelete

sendDelete

Asserts:

Get data:

seeResponseCodeIs

seeResponseCodeIsSuccessful

seeResponseTimeLess

seeResponseBodyFieldMatch

seeResponseHeaderMatch

seeResponseIsJsonType

seeResponseContainsJson

seeResponseContainsJson

seeResponseExactlyMatchJson

seeResponseExactlyMatchJson

seeResponseContainsJsonStrictOrder

seeResponseExactlyMatchJsonIgnoringOrder

seeResponseMatchesJsonSchema

seeResponseMatchesXmlSchema

seeResponseBodyElementsCount

grabResponseHeader

grabResponseBody

grabStringFromResponseByPath

grabDataFromResponseByPath

Configs:

.withContentTypeJson

.withContentTypeXml

.withContentType

.withoutContentType

.withMaxResponseMsAssert

.withLogging

.setHeader

.setHeaders

.setQueryParams

.setBearerAuth

.setBasicAuth

.setNoAuth

Interactions

sendGet

(String endpoint)

Send GET request

return: AssertableResponse

attach: request/response

sendHead

(String endpoint)

Send HEAD request

return: AssertableResponse

attach: request/response

sendOptions

(String endpoint)

Send OPTIONS request

return: AssertableResponse

attach: request/response

sendPost

(String endpoint)

Send POST request

return: AssertableResponse

attach: request/response

sendPost

(String endpoint, Object body)

Send POST request with body

return: AssertableResponse

attach: request/response

sendPut

(String endpoint)

Send PUT request

return: AssertableResponse

attach: request/response

sendPut

(String endpoint, Object body)

Send PUT request with body

return: AssertableResponse

attach: request/response

sendPatch

(String endpoint, Object body)

Send PATCH request with body

return: AssertableResponse

attach: request/response

sendDelete

(String endpoint)

Send DELETE request

return: AssertableResponse

attach: request/response

sendDelete

(String endpoint, Object body)

Send DELETE request with body

return: AssertableResponse

attach: request/response

Asserts

seeResponseCodeIs

(int statusCode)

Assert response StatusCode

seeResponseCodeIsSuccessful

()

Assert response StatusCode should be 2xx

seeResponseTimeLess

(long timeMs)

Assert response time less then maximum expected

seeResponseBodyFieldMatch

(String path, Matcher matcher)

Assert response Body field match matcher

seeResponseHeaderMatch

(String header, Matcher matcher)

Assert response header match matcher

seeResponseIsJsonType

()

Assert response is Json/JsonArray type

seeResponseContainsJson

(String expectedBody)

Json assertion without strict array ordering (extensible fields will be skipped)

attach: expected Json

seeResponseContainsJson

(Path path)

Json assertion without strict array ordering (extensible fields will be skipped)

attach: expected Json

expected Json in file

seeResponseExactlyMatchJson

(String expectedBody)

Json assertion with strict array ordering (extensible fields not expected)

attach: expected Json

seeResponseExactlyMatchJson

(Path path)

Json assertion with strict array ordering (extensible fields not expected)

attach: expected Json

expected Json in file

seeResponseContainsJsonStrictOrder

(String expectedBody)

Json assertion with strict array ordering (extensible fields will be skipped)

attach: expected Json

seeResponseExactlyMatchJsonIgnoringOrder

(String expectedBody)

Json assertion without strict array ordering (extensible fields not expected)

attach: expected Json

seeResponseMatchesJsonSchema

(Path path)

Validate that the response matches the JSON schema

attach: expected schema

expected schema in file

seeResponseMatchesXmlSchema

(Path path)

Validate that the response matches the XML schema

attach: expected schema

expected schema in file

seeResponseBodyElementsCount

(int expectedCount)

Assert that response body(JsonArray) has exactly count elements

Get Data

grabResponseHeader

(String header)

Grab response header data

attach: result

grabResponseBody

()

Grab response body

attach: body

return String

grabStringFromResponseByPath

(String path)

Grab response body field data (converted to String)

attach: result

return String

grabDataFromResponseByPath

(String path)

Grab response body field data

attach: result

return Object (can be any type)

Configs

.withContentTypeJson

()

Set content type JSON

.withContentTypeXml

()

Set content type XML

.withContentType

(ContentType contentType)

Set content type manually

ANY, TEXT, JSON, XML, HTML, URLENC, BINARY, MULTIPART

.withoutContentType

()

Set content type absent

.withMaxResponseMsAssert

(int maxResponseMs)

Set assert ms for max response time

(does not break the connection - only assert)

.withLogging

(boolean enable)

nables or disables logging manually (in console)

(debug log level will print logs anyway!)

.setHeader

(String key, String value)

Adds or updates a header

.setHeaders

(Map<String, String> headers)

Adds or updates a headers

.setQueryParams

Adds or updates a query parameters

Adds or updates a query parameters

.setBearerAuth

(String token)

Sets Bearer authentication

more priority than base auth!

.setBasicAuth

(String username, String password

Sets Basic authentication

.setNoAuth

()

Remove all authentications

© 2026 BUGREAPER

bottom of page