如何在Serenity BDD Framework中使用CSV在获取请求中发送多个值
如何在获取请求中传递具有多个值的CSV。 当我试图将值传递时,因为下面没有正确给出响应。请在此处提供帮助以获取响应。
例如:我的CSV文件包含ID的:15,16,20
我如何在Get请求中传递此ID。
员工csv
EmployeeID
15
16
20
@BeforeClass
public static void init() {
RestAssured.baseURI = "https://dummy.restapiexample.com/api/v1";
}
@Test
public void getAllRequests() {
ArrayList<String> employeeIDs = new ArrayList<>();
employeeIDs.add(employeeID);
SerenityRest.given().log().all().when().get("/employees/employeeID").then().log().all().statusCode(200);
System.out.println(employeeID);
}
}
How to pass CSV with multiple values in GET Request.
When I am tried to pass the values as below its not giving the response properly.please help here to get the response.
For Eg: My CSV file contains ID's: 15,16,20
How can I pass this ID's in GET request.
EmployeeID.csv
EmployeeID
15
16
20
@BeforeClass
public static void init() {
RestAssured.baseURI = "https://dummy.restapiexample.com/api/v1";
}
@Test
public void getAllRequests() {
ArrayList<String> employeeIDs = new ArrayList<>();
employeeIDs.add(employeeID);
SerenityRest.given().log().all().when().get("/employees/employeeID").then().log().all().statusCode(200);
System.out.println(employeeID);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此代码将适用于您的
文件CSV:
src/test/resources/employeeid.csv
This code would work for you
File csv at:
src/test/resources/EmployeeID.csv