210 Cucumber in depth [2d]

Updated . Posted . Visible to the public.

Advanced cucumber features

Learn about the following cucumber features:

Think of a practical application for each feature. If you can't think of one, discuss it with your mentor.

Also read through the card How to not repeat yourself in Cucumber scenarios.

Cucumber Factory

We have a very useful gem to create test data in cucumber: cucumber_factory Show archive.org snapshot .

Read through the README.

Integrate it into your MovieDB and replace your custom model creation steps with Cucumber Factory.

Simplify your Cucumber features

Look through your MovieDB features and step definitions. Can you spot opportunities to apply what you learnt?

  • Can you move duplicate steps to a Background or turn scenarios into a Scenario outline?
  • Can you use a Harness in your step definitions? Is it worth it?

If you cannot find any opportunities to DRY up a Cucumber scenario, do this exercise (testing the file upload from before):

  • Write a scenario: User can upload a movie poster in PNG format
  • Write a scenario: User can upload a movie poster in JPG format
  • DRY up both scenarios in a single scenario outline with two examples

Note

In practice the file extension check should belong in a unit test, not an E2E test.

Henning Koch
Last edit
Paul Demel
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra Curriculum (2017-02-03 14:04)