Typescript 黄瓜场景大纲:传递空格字符串“&引用;作为示例表中的值
我有一个Cucumber场景大纲,在其中的示例表中,我想传递6个空格字符串 (“”)作为值。在示例表中,将值留空,传递一个空字符串。我试过用双引号和单引号,结果是一样的。它传递8个字符串(包括2个引号),而不是6个 这是场景大纲的样子:Typescript 黄瓜场景大纲:传递空格字符串“&引用;作为示例表中的值,typescript,cucumber,bdd,gherkin,Typescript,Cucumber,Bdd,Gherkin,我有一个Cucumber场景大纲,在其中的示例表中,我想传递6个空格字符串 (“”)作为值。在示例表中,将值留空,传递一个空字符串。我试过用双引号和单引号,结果是一样的。它传递8个字符串(包括2个引号),而不是6个 这是场景大纲的样子: Scenario Outline: Change password - Negative Invalid Confirm Password Given I log in as a user on the change password page
Scenario Outline: Change password - Negative Invalid Confirm Password
Given I log in as a user on the change password page
When I insert the current password
And I insert password
And I insert invalid confirm password <value>
And I move focus to another element on the change password page
Then <message> appears under the confirm password field
Examples:
|value |message |
|Aa1! |Passwords Invalid or Do Not Match |
|" " |Passwords Invalid or Do Not Match |
When(/^I insert invalid confirmPassword (.*)$/, async (confirmNewPass:string) => {
await changePasswordPage.changePasswordComponent.insertConfirmNewPassword(confirmNewPass);
});
您需要像这样创建要素文件
Feature: Title of your feature
I want to use this template for my feature file
Scenario Outline: Title of your scenario outline
Given I want to write a step
When I check for the <value> in step
Then I verify the <message> in step
Examples:
|value |message |
| "Aa1!" | "Passwords Invalid or Do Not Match" |
| " " | "Passwords Invalid or Do Not Match" |
这真聪明!它是Java,但我需要用于此步骤定义的TypeScript:When(/^I插入无效的confirmPassword(.*)$/,async(confirmNewPass:string)=>{Wait changePasswordPage.changePasswordComponent.InsertConfigNewPassword(confirmNewPass);};我的错我也应该看看标签。我从未使用过我的朋友的打字稿,但在业余时间我会研究一下@DejanJovanović它也可以在类型脚本中工作。
@Given("I want to write a step")
public void i_want_to_write_a_step() {
// Write code here that turns the phrase above into concrete actions
System.out.println("In a given method!");
}
@When("I check for the {string} in step")
public void i_check_for_the_Aa1_in_step(String value) {
// Write code here that turns the phrase above into concrete actions
System.out.println("Value: " + value);
}
@Then("I verify the {string} in step")
public void i_verify_the_Passwords_Invalid_or_Do_Not_Match_in_step(String message) {
System.out.println("Message: " + message);
}