I am trying to demo serenity with Restassured at my workplace here and show them how awesome and easy it is to use in comparison to using jasmine.js How ever I am stuck with few things in the basic test I am trying to do My test says
Given we have valid credentials for the client using this test
When we try to serach for a medicine '<medicine>'
Then we get a valid '<perfLabel>' response with search results
|medicine|perflabel|
|Salbutamol|perflabel1|
|Panadol|perflabel2|
|Salbutamol (GA)|perflabel3|
When I go into the next step
@When("we try to serach for a medicine '(.*)' ")
public void tryToSearchUsingEquals(String medicine)
{
tsApiActions.requestServiceSearchWhichEquals(medicine);
}
In my Step method
@Step
public void requestServiceSearchWhichEquals(String medicine)
{
host = "http://www.int.abc.com.au/api/cs/v1/terminology-service/trade-product/search-summary?offset=0&limit=20&prefLabel=eq "+medicine+"&sort=prefLabel DESC&cache=false";
requestSend(host);
}
The questions I have are
Any help is really appreciated Thanks
RestAssured requests follow the same code structure which should be added into your sendRequest method:
given().
param("prefLabel", medicine).
when().
get(URL).
then().
body(containsString(medicine));
URL can come from property file, but you need to create a method to upload it before test run and then you have to create a getPropety() method to get the current value you need.
I suggest to read the official documentation here: https://github.com/rest-assured/rest-assured
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With