Class RestCukesSteps
java.lang.Object
org.chenile.cucumber.rest.RestCukesSteps
Cucumber steps to facilitate running tests using Spring MOCK MVC.
These steps are generic since they leverage the scripting language and JSON PATH etc. that are supported by Spring MVC.
See the methods below for the precise Gherkin language that has been created.
These steps are generic since they leverage the scripting language and JSON PATH etc. that are supported by Spring MVC.
See the methods below for the precise Gherkin language that has been created.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) CukesContextprivate MockMvcprivate final tools.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoida_REST_exception_is_thrown_with_message(String exceptionMessage) voidvoida_REST_exception_is_thrown_with_param_number_value(Integer pos, String message) voida_REST_exception_is_thrown_with_status_and_message_code(Integer errCode, Integer subErrCode) voida_REST_warning_must_be_thrown_that_says_with_code(String warningMessage, Integer errorNum) voida_REST_warning_must_be_thrown_that_says_with_code_and_http_status(String warningMessage, Integer subErrorCode, Integer httpStatus) voidvoidvoida_warning_must_be_thrown_that_has_field(String fieldValue) voidbefore()private GenericResponse<?> private StringvoidfixAndStoreJsonString(String expression, String alias) voidi_construct_a_REST_request_with_header_and_value(String headerName, String headerValue) voidi_DELETE_A_REST_Request_To_URL_With_Payload(String url, String docString) voidvoidi_PATCH_a_REST_request_to_URL(String url, String docString) voidi_POST_REST_request_with_payload(String url, String docString) voidi_PUT_a_REST_request_to_URL(String url, String docString) private voidinvokeHTTPMethod(HttpMethod method, String url, String docString) voidstore_from_response_to(String expression, String varName) private StringsubstituteVariables(String string) voidvoidCheck if the success inGenericResponseis truevoidthat_varName_equals_varValue(String varName, String varValue) voidcheck if the number of errors returned match the expected valuevoidthe_http_status_code_is(Integer statusCode) Check status codes.voidthe_REST_expression_size_is(String string, Integer int1) voidthe_REST_response_contains_key(String string) voidvoidvoidthe_REST_response_key_is(String key, String value) voidthe_top_level_code_is(Integer code) voidthe_top_level_description_is(String description) voidvoidthe_value_of_is(String key, String value) voidtheRESTResponseKeyCollectionContainsKeyWithKeysAndValues(String keyCollection, io.cucumber.datatable.DataTable dataTable) voidtheRESTResponseKeyCollectionContainsKeyWithValue(String keyCollection, String key, String value) voidtheRESTResponseKeyContainsString(String key, String value)
-
Field Details
-
mvc
-
objectMapper
private final tools.jackson.databind.ObjectMapper objectMapper -
context
CukesContext context
-
-
Constructor Details
-
RestCukesSteps
public RestCukesSteps()
-
-
Method Details
-
before
public void before() -
i_construct_a_REST_request_with_header_and_value
-
i_POST_REST_request_with_payload
-
i_DELETE_A_REST_Request_To_URL_With_Payload
-
i_GET_a_REST_request_to_URL
-
i_PUT_a_REST_request_to_URL
-
i_PATCH_a_REST_request_to_URL
-
invokeHTTPMethod
- Throws:
Exception
-
the_http_status_code_is
-
success_is_true
Check if the success inGenericResponseis true- Throws:
Exception- if there is an error in retrieving the results
-
success_is_false
-
the_REST_expression_size_is
-
the_REST_response_is_null
-
the_REST_response_contains_key
-
the_REST_response_key_is
-
the_value_of_is
-
theRESTResponseKeyContainsString
-
theRESTResponseKeyCollectionContainsKeyWithValue
-
theRESTResponseKeyCollectionContainsKeyWithKeysAndValues
-
the_REST_response_does_not_contain_key
-
the_error_array_size_is
-
the_top_level_code_is
-
the_top_level_subErrorCode_is
-
the_top_level_description_is
-
a_REST_warning_must_be_thrown_that_says_with_code
-
a_REST_warning_must_be_thrown_that_says_with_code_and_http_status
-
a_REST_warning_must_be_thrown_with_code
-
a_REST_warning_must_be_thrown_with_param_number_value
-
a_warning_must_be_thrown_that_has_field
-
a_REST_exception_is_thrown_with_status_and_message_code
-
a_REST_exception_is_thrown_with_message_code
-
a_REST_exception_is_thrown_with_param_number_value
-
a_REST_exception_is_thrown_with_message
-
extractGenericResponse
- Throws:
Exception
-
extractStringFromResponse
-
store_from_response_to
-
fixAndStoreJsonString
-
that_varName_equals_varValue
-
substituteVariables
-