通常,Cucumber 将输出背景步骤,使其看起来与您在功能文件中定义的步骤相同(位于顶部)。
$ bundle exec cucumber --color --format pretty
Feature: Something
Background:
Given step 1
And step 2
Scenario: a scenario
When I do step 3
Then it works
Scenario: another scenario
When I do a different step 3
Then it works
如果您始终可以在场景开始时显示这些步骤,则更容易看到后台步骤何时成功执行。如何启用此行为?
Feature: Something
Scenario: a scenario
Given step 1
And step 2
When I do step 3
Then it works
Scenario: another scenario
Given step 1
And step 2
When I do a different step 3
Then it works