让我说我有2节课-A级和B级。
在类B中必须使用从类A获得的JSON值。类A由junit和
运行假设方法名称为fetchEmployeeNumber()
String employeeNum;
@Title("This test will extract Employee Number")
@Test
public void fetchEmployeeNumber() {
employeeNum = response.then().extract().path("employeeNumber");
}
当我使用junit运行它时,此方法将打印employeeNumber。现在,我如何在其他B类中使用相同的employeeNum。因为它是junit,所以此方法的返回类型不能是String。
String employeeNum;
@Title("This test will give the result of the employee Number created")
@Test
public void setEmployeeNumber() {
SerenityRest.given()
.when()
.log()
.all()
.get("/result/employee/{employeeNum}");
}
我可以使用Excel工作表来执行此操作。通过将employeeNum存储在某个列中并在B类中调用它。如何使用代码实时处理它?</ p>