Changing Formatters

We think it’s starting to get distracting looking at the whole content of the feature in Cucumber’s output each time we run. Let’s switch to the progress formatter to get a more focused output. Run this command:

 $ ​​cucumber​​ ​​--format​​ ​​progress

You should see the following output:

 .ruby: No such file or directory -- calc.rb (LoadError)
 F-
 
 (::) failed steps (::)
 
 Command failed! (RuntimeError)
 ./features/step_definitions/calculator_steps.rb:10
 features/adding.feature:5
 
 Failing Scenarios:
 cucumber features/adding.feature:3 # Scenario: Add two numbers
 
 1 scenario (1 failed)
 3 steps (1 failed, 1 skipped, 1 passed)
 0m0.085s

Instead of printing the whole feature, the progress formatter has printed three characters in the output, one for each step. The first . character means the step passed. The F character means the second step, as we know, has failed. The final - character means that the last step has been skipped. Cucumber has several different formatters that you can use to produce different types of output as your features run; you’ll learn more about them through the course of the book.

That was an interesting little diversion, but let’s get back to work. We have a failing test to fix!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.37.154