如何将黄瓜小黄瓜语言中的 # 作为值处理而不是注释掉
How to handle # in cucumber Gherkin language as a value and not to comment out
Scenario Outline: verify handling "#" in code
Given user logs in to url "<url>"
When User enters Username "<UserName>" in username field
And User enters Password "<password>" in Password field
Then user should be logged in as <"screenName">
Examples:
|username|password|screenName|
|user |pwd# |User 1|
在上述情况下,我想将密码 "pwd#" 作为参数传递。
我该如何处理这个问题,确保 # 不会被视为注释掉该行的剩余部分。
请帮助我。
我加了一个反斜杠,好像没问题。编辑不喜欢,但是运行.
Given I have a \#2 web services
步骤看起来像:
Given(/^I have a \\#(\d+) web services$/) do |num|
expect(num).to eq(num.to_i.to_s)
end
输出看起来像:
@pound
Scenario: client rest GET
Given I have a \#2 web services
1 scenario (1 passed)
1 step (1 passed)
0m0.005s
顺便说一句,我只在开始的步骤中添加了 \# 然后 运行 cuke。我告诉我 step def 字符需要是什么。如果你明白我的意思,那就是一个好朋友。
Scenario Outline: verify handling "#" in code
Given user logs in to url "<url>"
When User enters Username "<UserName>" in username field
And User enters Password "<password>" in Password field
Then user should be logged in as <"screenName">
Examples:
|username|password|screenName|
|user |pwd# |User 1|
在上述情况下,我想将密码 "pwd#" 作为参数传递。
我该如何处理这个问题,确保 # 不会被视为注释掉该行的剩余部分。
请帮助我。
我加了一个反斜杠,好像没问题。编辑不喜欢,但是运行.
Given I have a \#2 web services
步骤看起来像:
Given(/^I have a \\#(\d+) web services$/) do |num|
expect(num).to eq(num.to_i.to_s)
end
输出看起来像:
@pound
Scenario: client rest GET
Given I have a \#2 web services
1 scenario (1 passed)
1 step (1 passed)
0m0.005s
顺便说一句,我只在开始的步骤中添加了 \# 然后 运行 cuke。我告诉我 step def 字符需要是什么。如果你明白我的意思,那就是一个好朋友。