Maa*_*aal 5 java rest serenity-bdd
我试图在我的工作场所用Restassured来展示宁静,并告诉他们与使用jasmine.js相比,它是多么棒和容易使用我怎么会在基本测试中遇到一些问题我试图做我的测试说
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|
Run Code Online (Sandbox Code Playgroud)
当我进入下一步
@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);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是
任何帮助非常感谢谢谢
小智 1
RestAssured 请求遵循相同的代码结构,应将其添加到您的 sendRequest 方法中:
given().
param("prefLabel", medicine).
when().
get(URL).
then().
body(containsString(medicine));
Run Code Online (Sandbox Code Playgroud)
URL 可以来自属性文件,但您需要创建一个方法来在测试运行之前上传它,然后您必须创建一个 getPropety() 方法来获取您需要的当前值。
我建议在这里阅读官方文档: https://github.com/rest-assured/rest-assured
| 归档时间: |
|
| 查看次数: |
650 次 |
| 最近记录: |