然后给出的指标但是?

Pri*_*ign 6 syntax cucumber specflow gherkin

我一直在使用SpecFlow,没有使用"但是"逻辑.

考虑以下情况:

Scenario: Kiran logs into the system but doesn't click remember me
Given I have a username of 'Kiran'
And a password of 'password'
When I chose login
But I don't chose remember me
Then I should be logged in
And Taken to the home screen
But My username should not be remembered
Run Code Online (Sandbox Code Playgroud)

难道"but"步骤不能与"和"互换吗?

使用"但是"有什么好处吗?

我是否正确地认为这纯粹是为了可读性目的?

我期待听到你对此的看法.

非常感谢,Kiran

Ben*_*ith 11

是的,你是对的,"和"和"但是"在小黄瓜语法中是可以互换的.

然而,根据我的经验,当您指示用户应该执行操作时使用"和" ,而当您想突出显示用户不应执行操作时,"但"最适合使用; 这是因为英语中的"但"通常用于负面背景.

因此在你的例子中:

但我没有选择记住我

好好利用"但是",因为他们没有采取行动.另外使用"but"使测试的意图明确并消除任何可能的歧义.

  • 没有问题:D这是一个很好的问题,它有助于我在回答这样的问题时巩固我的理解. (2认同)
  • @BenSmith 不,但现在我认为是时候将其标记为已回答了!哈哈抱歉我错过了你五月份的评论。 (2认同)