Package core.apiCore.interfaces
Class RestApiInterface
java.lang.Object
core.apiCore.interfaces.RestApiInterface
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.restassured.response.Responseevaluate(ServiceObject serviceObject) static voidevaluateOption(ServiceObject serviceObject) sets the header, content type And body based on specificationsstatic io.restassured.response.ResponseevaluatePagination(ServiceObject serviceObject) evaluate pagination format: http://url?page=invalid input: '<'@PAGINATION_FROM_1> counter will start from page 1 will iterate through the pages until either: - the expected response criteria is met - max pages are reached.static io.restassured.specification.RequestSpecificationevaluateQueryParameters(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) evaluate query parameters format: "name=key=valueinvalid input: '&key2'=value2"static ServiceObjectevaluateRequest(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) static ServiceObjectevaluateRequestAndReceiveResponse(ServiceObject serviceObject) evaluates the request and stores the response in service objectstatic booleanevaluateRequestAndValidatePagination(ServiceObject serviceObject) static io.restassured.response.ResponseevaluateRequestAndValidateResponse(ServiceObject serviceObject) evaluate request and validate response retry until validation timeout period in seconds RetryAfterSecond is based on waiting after the validation round is complete, including wait for response wait periodstatic io.restassured.specification.RequestSpecificationevaluateRequestBody(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) static io.restassured.specification.RequestSpecificationevaluateRequestHeaders(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) sets the header, content type And body based on specifications Headers are based on key value, separated by ";" Invalid token: if authorization token exists, replace last values with "invalid", else set to "invalid" we replace parameters per authentication typestatic URLget base url from the configstatic booleanstatic io.restassured.response.ResponseRestfullApiInterface(ServiceObject serviceObject) interface for restful API callsstatic voidsaveOutBoundValues(ServiceObject serviceObject) static voidsetProxy()set proxy from config file value to use proxy is set at API_AUTO_PROXY_SET We evaluate if we need to use proxy once in test runstatic voidset connection timeout in millisecondsstatic io.restassured.specification.RequestSpecificationsetURI(ServiceObject serviceObject) sets base uri for api callvalidateResponse(ServiceObject serviceObject) validateStatusCode(io.restassured.response.Response response, ServiceObject serviceObject) validate status code
-
Field Details
-
API_TIMEOUT_PAGINATION_VALIDATION_ENABLED
- See Also:
-
API_PAGINATION_STOP_CRITERIA
- See Also:
-
API_PAGINATION_MAX_PAGES
- See Also:
-
API_PAGINATION_PAGES_FROM
- See Also:
-
API_PAGINATION_INCREMENT
- See Also:
-
API_PAGINATION_COUNTER
- See Also:
-
API_PARAMETER_ENCODING
- See Also:
-
API_USE_RELAXED_HTTPS_VALIDATION
- See Also:
-
API_BASE_URL
- See Also:
-
-
Constructor Details
-
RestApiInterface
public RestApiInterface()
-
-
Method Details
-
RestfullApiInterface
interface for restful API calls- Parameters:
serviceObject-- Returns:
-
evaluate
-
evaluateRequestAndValidateResponse
public static io.restassured.response.Response evaluateRequestAndValidateResponse(ServiceObject serviceObject) evaluate request and validate response retry until validation timeout period in seconds RetryAfterSecond is based on waiting after the validation round is complete, including wait for response wait period- Parameters:
serviceObject-- Returns:
-
evaluatePagination
evaluate pagination format: http://url?page=invalid input: '<'@PAGINATION_FROM_1> counter will start from page 1 will iterate through the pages until either: - the expected response criteria is met - max pages are reached. specified by PAGINATION_MAX_PAGES:100 in options - response criteria for max pages is reached. OPTION_PAGINATION_STOP_CRITERIA:.results.id - if the list of responses on a selected page is 0, that means the page has no results, hence, it is the last page- Parameters:
serviceObject-- Returns:
-
evaluateRequestAndValidatePagination
-
evaluateRequestAndReceiveResponse
evaluates the request and stores the response in service object- Parameters:
serviceObject-- Returns:
-
setURI
sets base uri for api call- Returns:
-
setTimeout
public static void setTimeout()set connection timeout in milliseconds -
setProxy
public static void setProxy()set proxy from config file value to use proxy is set at API_AUTO_PROXY_SET We evaluate if we need to use proxy once in test run- Throws:
Exception
-
getProxyState
public static boolean getProxyState() -
validateResponse
-
saveOutBoundValues
-
validateStatusCode
public static List<String> validateStatusCode(io.restassured.response.Response response, ServiceObject serviceObject) validate status code- Parameters:
response-serviceObject-- Returns:
-
evaluateRequestHeaders
public static io.restassured.specification.RequestSpecification evaluateRequestHeaders(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) sets the header, content type And body based on specifications Headers are based on key value, separated by ";" Invalid token: if authorization token exists, replace last values with "invalid", else set to "invalid" we replace parameters per authentication type- Parameters:
serviceObject-- Returns:
-
evaluateQueryParameters
public static io.restassured.specification.RequestSpecification evaluateQueryParameters(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) evaluate query parameters format: "name=key=valueinvalid input: '&key2'=value2"- Parameters:
serviceObject-request-- Returns:
-
evaluateRequestBody
public static io.restassured.specification.RequestSpecification evaluateRequestBody(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) -
evaluateOption
sets the header, content type And body based on specifications- Parameters:
serviceObject-
-
evaluateRequest
public static ServiceObject evaluateRequest(ServiceObject serviceObject, io.restassured.specification.RequestSpecification request) -
getBaseUrl
get base url from the config- Returns:
-