Modifier and Type | Field and Description |
---|---|
protected APIServerConnector |
apiServerConnector |
protected PassFailResults |
passFailResults |
protected com.jayway.restassured.response.Response |
response
NOTE:
response is global, so it can be logged from runAfterMethod |
Constructor and Description |
---|
ServiceTestBase()
Initializes the ServiceTestBase without a limit for logged responses.
|
ServiceTestBase(int responseLogLengthLimit)
Initializes the ServiceTestBase with a specific character limit for the logged responses.
|
Modifier and Type | Method and Description |
---|---|
void |
assertReturnCode(com.jayway.restassured.response.Response response,
int expectedStatusCode)
Asserts that the
response has the {code expectedStatusCode} |
void |
infoLogResponse(com.jayway.restassured.response.Response response)
Writes the response to log at the INFO level
|
static void |
main(String[] args) |
String |
prettyResponse(com.jayway.restassured.response.Response response)
Returns
response as a String attempting to improve readability
If body is empty return the empty string. |
protected void |
runAfterClassBase() |
protected void |
runAfterMethodBase(org.testng.ITestResult result) |
protected void |
runBeforeClassBase() |
protected void |
runBeforeMethodBase(Method method)
Will run before all annotated test methods.
|
protected void |
setResponseLogLengthLimit(int responseLogLengthLimit)
Sets the character limit for response logs.
|
protected APIServerConnector apiServerConnector
protected PassFailResults passFailResults
protected com.jayway.restassured.response.Response response
response
is global, so it can be logged from runAfterMethod
public ServiceTestBase()
public ServiceTestBase(int responseLogLengthLimit)
responseLogLengthLimit
- the length limit for logged responses.public static void main(String[] args)
public String prettyResponse(com.jayway.restassured.response.Response response)
response
as a String attempting to improve readability
If body is empty return the empty string.response
- the response returned by a REST API callpublic void infoLogResponse(com.jayway.restassured.response.Response response)
response
- the response returned by a REST API callpublic void assertReturnCode(com.jayway.restassured.response.Response response, int expectedStatusCode)
response
has the {code expectedStatusCode}response
- the response returned by a REST API callexpectedStatusCode
- the status code expected in the responseprotected void setResponseLogLengthLimit(int responseLogLengthLimit)
responseLogLengthLimit
- the character limit for response logsprotected void runBeforeClassBase()
protected void runAfterClassBase()
protected void runBeforeMethodBase(Method method)
response
object to null o avoid that the
AfterMethod prints a prior methods response, if the failure/abort occurred before a new response is set.method
- TestNG will pass in the method about to be called.Copyright © 2016. All rights reserved.