简体   繁体   English

我们如何同时执行 2 个 get 请求 放心的 API 测试

[英]How can we perform 2 get request at same time Rest assured API Testing

JAVA RESTASSURED APITESTNG CUCUMBER JAVA RESTASSURED APITESTNG CUCUMBER

when I send get request using path variable and query param, I get a token in the response body and I will not get proper response until I add that token as a query param and send another get request.当我使用路径变量和查询参数发送获取请求时,我在响应正文中得到一个令牌,并且在我将该令牌添加为查询参数并发送另一个获取请求之前,我不会得到正确的响应。

So How can I perform that?那么我该如何执行呢?

Given Cucumber Feature File给定的黄瓜特征文件

  • Given API has the following filed <"fieldName">给定 API 具有以下字段 <"fieldName">
  • When API sends a "GET" request to "TranscationAPI"当 API 向“TranscationAPI”发送“GET”请求时
  • Then API will receive the response code as 200然后 API 将收到响应代码为 200
  • And the body will have following field并且身体将有以下字段

Should I change it to something like this?我应该把它改成这样吗?

  • Given API has the following filed <"fieldName">给定 API 具有以下字段 <"fieldName">
  • When API sends a "GET" request to "TranscationAPI"当 API 向“TranscationAPI”发送“GET”请求时
  • Then API will receive token as ""然后 API 将接收令牌为“”
  • When API sends again "GET" request to "TranscationAPI"当 API 再次向“TranscationAPI”发送“GET”请求时
  • Then API will receive the response code as 200然后 API 将收到响应代码为 200
  • And the body will have following field并且身体将有以下字段

Or I can use handle this through a different method.或者我可以通过不同的方法来处理这个问题。

背景是获取令牌的好地方 - 见https://cucumber.io/docs/gherkin/reference/#background

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM