public final class WsStep
extends java.lang.Object
| Constructor and Description |
|---|
WsStep() |
| Modifier and Type | Method and Description |
|---|---|
static void |
downloadFileFromResponse(java.lang.String name,
com.sun.jersey.api.client.ClientResponse response)
This method downloads and save file from the response in report directory for current execution.
|
static com.sun.jersey.api.client.ClientResponse |
request(WsRequestBean bean) |
static void |
responseHasNotValueAtXpath(java.lang.Object val,
java.lang.String xpath)
This is assertion method to check value is not at XPATH in response
status of web service.
|
static void |
responseHasNotXpath(java.lang.String xpath)
This assertion method check given Xpath is not there in response status
of web service.
|
static void |
responseHasValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
This is assertion method to check value at jsonpath in response status of
web service.
|
static void |
responseHasValueAtXpath(java.lang.Object val,
java.lang.String xpath)
This is assertion method to check value at XPATH in response status of
web service.
|
static void |
responseHasValueNotAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
This is assertion method to check value is not at jsonpath in response
status of web service.
|
static void |
responseHasXpath(java.lang.String xpath)
This assertion method check given Xpath is there in response status of
web service.
|
static void |
responseShouldGreaterThan(double expectedValue,
java.lang.String path)
This method validates that value at jsonpath should be greater than
expectedvalue
|
static void |
responseShouldGreaterThanOrEqualsTo(double expectedValue,
java.lang.String path)
This method validates that value at jsonpath should be greater than or
equal to expectedvalue
|
static void |
responseShouldHaveHeader(java.lang.String header)
This method check given header is there in response of web service
|
static void |
responseShouldHaveHeaderWithValue(java.lang.String header,
java.lang.String value)
This method check given header with specific value present in response of
web service
|
static void |
responseShouldHaveJsonPath(java.lang.String path)
This method check given jsonpath is there in response of web service
|
static void |
responseShouldHaveKeyAndValueContains(java.lang.String value,
java.lang.String path)
This method validates value of jsonpath contains expected value or not
|
static void |
responseShouldHaveKeyWithValue(java.lang.Object expectedValue,
java.lang.String path)
This method validates value for given jsonpath
|
static void |
responseShouldHaveStatus(java.lang.String status)
This method check for the response status of web service
|
static void |
responseShouldHaveStatusCode(int statusCode)
This method check for the response status of web service
|
static void |
responseShouldHaveValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
This is verification method to check value at jsonpath in response status
of web service.
|
static void |
responseShouldHaveValueAtXpath(java.lang.Object val,
java.lang.String xpath)
This is verification method to check value at XPATH in response status of
web service.
|
static void |
responseShouldHaveValueContainsIgnoringCase(java.lang.String expectedValue,
java.lang.String path)
This method validates value at jsonpath contains expected value with
ignoring case or not
|
static void |
responseShouldHaveValueIgnoringCase(java.lang.String expectedValue,
java.lang.String path)
This method validates value at jsonpath equals to expected value with
ignoring case or not
|
static void |
responseShouldHaveValueMatchesWith(java.lang.String regEx,
java.lang.String path)
This method validates value of jsonpath matches with regEx value or not
|
static void |
responseShouldHaveXpath(java.lang.String xpath)
This is verification method to check given Xpath is there in response
status of web service.
|
static void |
responseShouldLessThan(double expectedValue,
java.lang.String path)
This method validates that value at jsonpath should be less than
expectedvalue
|
static void |
responseShouldLessThanOrEqualsTo(double expectedValue,
java.lang.String path)
This method validates that value at jsonpath should be less than or equal
to expectedvalue
|
static void |
responseShouldNotHaveJsonPath(java.lang.String path)
This method check given jsonpath is not in response of web service
|
static void |
responseShouldNotHaveValue(java.lang.Object expectedValue,
java.lang.String path)
This method validates value of jsonpath is not equal to expected value
|
static void |
responseShouldNotHaveValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
This is verification method to check value is not at jsonpath in response
status of web service.
|
static void |
responseShouldNotHaveValueAtXpath(java.lang.Object val,
java.lang.String xpath)
This is verification method to check value at XPATH in response status of
web service.
|
static void |
responseShouldNotHaveXpath(java.lang.String xpath)
This is verification method to check given Xpath is not there in response
status of web service.
|
static void |
sayValueAtJsonPath(java.lang.String variable,
java.lang.String path)
This method store value of given json path to
ConfigurationManager |
static void |
sayValueAtXPath(java.lang.String variable,
java.lang.String path)
This method store value of given xpath to
ConfigurationManager |
static void |
storeResponseBodyto(java.lang.String path,
java.lang.String variable)
Deprecated.
|
static void |
storeResponseHeaderTo(java.lang.String header,
java.lang.String property)
This method store value of given header to
ConfigurationManager |
static com.sun.jersey.api.client.ClientResponse |
userRequests(java.lang.Object request)
This method request for the given parameters
|
static com.sun.jersey.api.client.ClientResponse |
userRequests(java.lang.Object request,
java.util.Map<java.lang.String,java.lang.Object> data)
This method request for given parameters with given dataset
|
static boolean |
verifyResponseSchema(java.lang.String requestKey) |
public static void responseShouldHaveStatus(java.lang.String status)
Example:
BDD
response should have status 'ResponceStatus'
KWD
status - : {0} : Status String for Exampe: OK, CREATEDClientResponse.Statuspublic static void responseShouldHaveStatusCode(int statusCode)
Example:
BDD
response should have status 'ResponceStatus'
KWD
status - : {0} : Status code, for example 200, 301ClientResponse.Statuspublic static com.sun.jersey.api.client.ClientResponse userRequests(java.lang.Object request)
request - key or mappublic static com.sun.jersey.api.client.ClientResponse userRequests(java.lang.Object request,
java.util.Map<java.lang.String,java.lang.Object> data)
request - key or mapdata - data set of key value pairpublic static void responseShouldHaveHeader(java.lang.String header)
Example:
BDD
response should have header 'Content-Type'
header - : header to be verified in resposepublic static void responseShouldHaveHeaderWithValue(java.lang.String header,
java.lang.String value)
Example:
BDD
response should have header 'Content-Type' with value 'application/json'
header - : header to be present in resposevalue - : value to be verified for headerpublic static void responseShouldHaveJsonPath(java.lang.String path)
Example:
response should have 'user.username'
path - : jsonpathpublic static void responseShouldNotHaveJsonPath(java.lang.String path)
Example:
response should not have 'user.username'
path - : jsonpathpublic static void responseShouldHaveKeyWithValue(java.lang.Object expectedValue,
java.lang.String path)
Example:
response should have 'admin' at 'user.username'
expectedValue - : expected valuepath - : jsonpathpublic static void storeResponseBodyto(java.lang.String path,
java.lang.String variable)
sayValueAtJsonPath(String, String)ConfigurationManager
Example:
store response body 'user.username' to 'loginuser'
path - jsonpathvariable - variable that can be use laterpublic static void responseShouldHaveKeyAndValueContains(java.lang.String value,
java.lang.String path)
Example:
response should have value contains 'admin' at 'user.username'
value - : expected valuepath - : jsonpathpublic static void storeResponseHeaderTo(java.lang.String header,
java.lang.String property)
ConfigurationManager
Example:
store response header 'X-Auth-token' to 'token'
header - headerproperty - variable that can be use laterpublic static void responseShouldLessThan(double expectedValue,
java.lang.String path)
Example:
response should be less than 500 at 'student.totalmarks'
value - : expected valuepath - : jsonpathpublic static void downloadFileFromResponse(java.lang.String name,
com.sun.jersey.api.client.ClientResponse response)
throws java.io.IOException
BDD Example:
Given user requests "download.file.req"
And store into 'file.response'
Then save file as "logo.png" from "${file.response}"
Java Example:
ClientResponse response = userRequests("download.file.req");
downloadFileFromResponse("logo.png", response);
name - response - java.io.IOExceptionpublic static void responseShouldLessThanOrEqualsTo(double expectedValue,
java.lang.String path)
Example:
response should be less than or equals to 500 at 'student.totalmarks'
value - : expected valuepath - : jsonpathpublic static void responseShouldGreaterThan(double expectedValue,
java.lang.String path)
Example:
response should be greater than 500 at 'student.totalmarks'
value - : expected valuepath - : jsonpathpublic static void responseShouldGreaterThanOrEqualsTo(double expectedValue,
java.lang.String path)
Example:
response should be greater than or equals to 500 at 'student.totalmarks'
value - : expected valuepath - : jsonpathpublic static void responseShouldHaveValueIgnoringCase(java.lang.String expectedValue,
java.lang.String path)
Example:
response should have value ignoring case 'admin' at 'user.username'
value - : expected valuepath - : jsonpathpublic static void responseShouldHaveValueContainsIgnoringCase(java.lang.String expectedValue,
java.lang.String path)
Example:
response should have value contains ignoring case 'admin' at 'user.username'
value - : expected valuepath - : jsonpathpublic static void responseShouldHaveValueMatchesWith(java.lang.String regEx,
java.lang.String path)
Example:
response should have value matches with '[a-z]*' at 'user.username'
value - : expected valuepath - : jsonpathpublic static void responseShouldNotHaveValue(java.lang.Object expectedValue,
java.lang.String path)
Example:
response should not have value 'admin' at 'user.username'
value - : expected valuepath - : jsonpathpublic static boolean verifyResponseSchema(java.lang.String requestKey)
public static void responseShouldHaveValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response should have value '1.90' at jsonpath '$.Price'
response should have value 'gte:1.90' at jsonpath '$.Price'
KWD
val - : {val} : value to be verified in responsejsonpath - : {jsonpath} : jsonpath to look value in responsepublic static void responseShouldNotHaveValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
StringMatcher to match expected vs actual values. You can
specify matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response should not have value '1.90' at jsonpath '$.Price'
response should not have value 'gte:1.90' at jsonpath '$.Price'
KWD
val - : {val} : value to be verified in responsejsonpath - : {jsonpath} : jsonpath to look value in responsepublic static void responseHasValueAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response has value '1.90' at jsonpath '$.Price'
response has value 'gte:1.90' at jsonpath '$.Price'
KWD
val - : {val} : value to be verified in responsejsonpath - : {jsonpath} : jsonpath to look value in responsepublic static void responseHasValueNotAtJsonpath(java.lang.Object val,
java.lang.String jsonpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response has not value '1.90' at jsonpath '$.Price'
response has not value 'gte:1.90' at jsonpath '$.Price'
KWD
val - : {val} : value to be verified in responsejsonpath - : {jsonpath} : jsonpath to look value in responsepublic static void sayValueAtJsonPath(java.lang.String variable,
java.lang.String path)
ConfigurationManager
Example:
say 'loginuser' is value at jsonpath 'user.username'
variable - variable that can be use laterpath - jsonpathpublic static void responseShouldHaveXpath(java.lang.String xpath)
Example:
BDD
response should have xpath 'Xpath String'
KWD
xpath - : {0} : xpath string to be verified in responsepublic static void responseShouldNotHaveXpath(java.lang.String xpath)
Example:
BDD
response should not have xpath 'Xpath String'
KWD
xpath - : {0} : xpath to be verified in responsepublic static void responseShouldHaveValueAtXpath(java.lang.Object val,
java.lang.String xpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response should have value '1.90' at xpath '//Price'
response should have value 'gte:1.90' at xpath '//Price'
KWD
val - : {val} : value to be verified in responsexpath - : {xpath} : xpath to look value in responsepublic static void responseShouldNotHaveValueAtXpath(java.lang.Object val,
java.lang.String xpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response should have value '1.90' at xpath '//Price'
response should have value 'gte:1.90' at xpath '//Price'
KWD
val - : {val} : value to be verified in responsexpath - : {xpath} : xpath to look value in responsepublic static void responseHasXpath(java.lang.String xpath)
Example:
BDD
response should have xpath 'Xpath String'
KWD
xpath - : {0} : xpath string to be verified in responsepublic static void responseHasNotXpath(java.lang.String xpath)
Example:
BDD
response has not xpath 'Xpath String'
KWD
xpath - : {0} : xpath to be verified in responsepublic static void responseHasValueAtXpath(java.lang.Object val,
java.lang.String xpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response has value '1.90' at xpath '//Price'
response has value 'gte:1.90' at xpath '//Price'
KWD
val - : {val} : value to be verified in responsexpath - : {xpath} : xpath to look value in responsepublic static void responseHasNotValueAtXpath(java.lang.Object val,
java.lang.String xpath)
StringMatcher to match expected vs actual values. You can specify
matcher by providing prefix separated by ':', For example,
'containsIgnoringCase:someValue' will use
StringMatcher.containsIgnoringCase(String) Default is
StringMatcher.exact(String)
Example:
BDD
response has not value '1.90' at xpath '//Price'
response has not value 'gte:1.90' at xpath '//Price'
KWD
val - : {val} : value to be verified in responsexpath - : {xpath} : xpath to look value in responsepublic static void sayValueAtXPath(java.lang.String variable,
java.lang.String path)
ConfigurationManager
Example:
say 'loginuser' is value at xpath '//user/username'
variable - variable that can be use laterpath - xpathpublic static com.sun.jersey.api.client.ClientResponse request(WsRequestBean bean)
Copyright © 2000 Infostretch Corp.