【发布时间】:2021-08-06 19:31:49
【问题描述】:
我有一个测试用例,它想用一些特定的和生成的数据创建一个用户,并且它想存储生成的数据以再次重复此方法。但是,当它运行第二次创建时,我得到了存储的数据 + 新生成的数据。我想取回没有生成值的存储数据。
@When("I create a new user with id: {smartString}, " +
"name: {smartString} and birth: {smartString}")
public void CreateNewUnit(String id, String name, String date) {
String testName = name + "-" + RandomUtils.getRandomNumeric(6);
szepScenarioContext.storeVariable(testName, "testName");
$(getBy("Create button")).click();
$(getBy("Id field")).sendKeys(id);
$(getBy("Name field")).sendKeys(testName);
$(getBy("Birth field")).sendKeys(date);
$(getBy("Submit button")).click();
}
Scenario: Create a user
Given I navigate to the XY page
When I create a new user with id: "123", name: "Test" and birth: "1999.12.12."
And I create a new user with id: "123", name: "<$testName>" and birth: "1999.12.12."
【问题讨论】: