Details:
We currently use Mockito/ Wiremock (in different teams), Junit and Cucumber in our test procedure.
And test cases are functional, but we want to extend them with regard to post procedures.
Currently we have a test case that asks for the customer ID (used here is Mockito + Wiremock + Junit 4 different Teams) this test should now in a further step use the customer ID (that he has determined) to create another test case based on the determined customer ID.
Source:
Feature File Information: (Working Scenario), in the Give part we only start Mockito or Wiremock
Feature File Example:
When <headerName_PropFile> and <headerValue_PropFile> is added to request
When POST request for <JsonRequest> is sent
Then response code is the <StatusCode>
Then Validate Responses <expectedValue1>
Then Validate Response <expectedValue2>
Then Validate against Swagger
In the further course we have of course adapted the API according to Cucumber, there given,when, then formulated, but we are missing a possibility how we could use the step definition results like a determined customer ID in further steps.
Example for API + Cucumber
@When("^PATCH request for (.+) is sent")
public void sendPatchRequestF3(String requestBodyFile) throws Throwable {
//GenerateReport.stepName = "When PATCH request is sent with request body";
Object requestBody = setDataInJSON(getValue(requestBodyFile));
request.body(requestBody.toString());
FilterableRequestSpecification httpRequest = (FilterableRequestSpecification) request;
Reporter.addStepLog("Request URL : " + httpRequest.getURI());
sendRequest("PATCH");
Reporter.addStepLog("Response Body: " + response.prettyPrint());
//GenerateReport.reportStepStatus("pass", "Response body: " + response.prettyPrint());
}
Questions:
- How can we integrate values determined in further steps into the feature file in such a way that the new values are integrated accordingly, thus creating new test queries?