Testing web services? With no UI? Isn’t that a Developers job?
Well… No…
Since 2010, there’s a free open source tool on the testing market which enables you to easily create web service requests and evaluation of responses. Nevertheless, it offers a cool Gherkin-style syntax which makes it even easier to understand and use.
Since it is a free tool then it is only skills that are required to use it. And that would be just basic Java programming knowledge.
Here’s a sample of what a simple RestAssured test would look like:
CreateInvoiceRequest request = new CreateInvoiceRequest();
@Test
public void testInvoiceCreation(){
given().request()
.body(request.setInvoiceNumber("someNumber").setInvoiceItem("someItem").done())
.when().post()
.then().statusCode(200)
.body(hasToString(containsString("<ns2:TotalRegistries>1</ns2:TotalRegistries>")))
.body(hasToString(containsString(request.getInvoiceNumber())));
}
And where outside of it, we have defined the request template which we’re going to use in CreateInvoiceRequest
Here are the results:
That is just one scenario which creates an invoice. Note that the execution time is about 1.5 seconds.
Next stop integrating tests in the build process.