提问者:小点点

在cucumber上的一个功能文件中运行多个背景


我还没有尝试过这个,但理论上我假设在Cucumber上的一个功能文件中添加多个背景是错误的做法。

Background:
Given I am on the SignIn Page

Scenario: I am able to . .. . . .
When I . . . . .
Then I . . . . .

Background:
Given I signin
    
Scenario: I am able to . . . .
When I . . . .
Then I . . . .

想知道这是否可能?

谢啦


共1个答案

匿名用户

答案:

“每个功能或规则只能有一组后台步骤。如果您需要针对不同场景使用不同的后台步骤,请考虑将您的场景集分解为更多规则或更多功能。”

https://cucumber.io/docs/gherkin/reference/#background