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
- How do i inject the variables(Salbutamol, Panadol) into the uri?
- How do I put this URI into a seperate properties file and call it in the Step method?
Any help is really appreciated Thanks
RestAssured requests follow the same code structure which should be added into your sendRequest method:
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