功能文件中是否提供其他概念(小黄瓜语言)? [英] Does if else concept available in feature file (Gherkin language)?

查看:77
本文介绍了功能文件中是否提供其他概念(小黄瓜语言)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,我们可以在特征文件中使用if / else概念吗?例如:

Is there anyway where we can use if/else concept in feature file? For example:

  Scenario: User should be able to check login page
  Given I am on login page
  When I click on SignIn button 
  Then I should be in home page 
  If yes
  Then I will create a new profile
  Else
  Then I will logout from page 


推荐答案

我不知道。但是,小黄瓜(和黄瓜)在指定谨慎的业务案例时最好使用,并且应该可重复使用,否则它们将难以遵循和测试。看来您至少有两个故事:

Not that I am aware of. Gherkin (and cucumber) are best used when they specify discreet business cases though, and should be repeatable, else they get hard to follow and test. It looks like you have two stories here at least:

Scenario: A new user should be asked to sign in
  Given I am a new user
  And I navigate to the login page
  When I click on SignIn button
  I should not be able to get to the home page

Scenario: An existing user should be able to log in
  Given I am an existing user
  And I navigate to the login page
  And I submit valid credentials
  When I click on SignIn button
  I should be taken to the home page

这篇关于功能文件中是否提供其他概念(小黄瓜语言)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆