我有一个变量,我想在所有步骤中传递这个变量.任何人都可以建议使用代码片段示例,请参阅如何在步骤之间传递变量值.任何帮助将受到高度赞赏.
我需要自动化一些网络服务,我为此创建了一些方法,并且我想使用 Cucumber 来实现这一点,但我不知道如何在下一步中使用返回值。
所以,我有这个功能:
Feature: Create Client and place order
Scenario: Syntax
Given I create client type: "66"
And I create for client: "OUTPUTVALUEfromGiven" an account type "123"
And I create for client: "OUTPUTVALUEfromGiven" an account type "321"
And I want to place order for: "outputvalueFromAnd1"
Run Code Online (Sandbox Code Playgroud)
我有这个步骤:
public class CreateClientSteps {
@Given("^I create client type: \"([^\"]*)\"$")
public static String iCreateClient(String clientType) {
String clientID = "";
System.out.println(clientType);
try {
clientID = util.createClient(clientType);
} catch (IOException e) {
e.printStackTrace();
}
return …Run Code Online (Sandbox Code Playgroud)