Read more

Upgrading a Rails app to Cucumber 3

Henning Koch
February 28, 2018Software engineer at makandra GmbH

Upgrade gems

You need to update a lof gems. Make sure you don't have any version constraints in your Gemfile or your bundle update won't do anything!

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Upgrade cucumber_priority:

bundle update cucumber_priority

Upgrade spreewald:

bundle update spreewald

Upgrade cucumber_factory:

bundle update cucumber_factory

Upgrade parallel_tests:

bundle update parallel_tests

Even on the latest version, parallel_tests will print some deprecation warnings due to using an older formatter API. Maybe there will be a fix for that eventually.

Update cucumber-rails to >= 1.6.0:

bundle update cucumber-rails

Upgrade cucumber:

bundle update cucumber

Make sure you have a recent version of geordi (it doesn't belong in your Gemfile!):

gem install geordi

Check if you're using Transforms

Transform is no longer supported in Cucumber 3.

There is something similiar called ParameterType Show archive.org snapshot . A ParameterType is no longer applied blindly to all strings that match. Step definitions need to explicitely define that they're using a ParameterType.

Use the new tag syntax

Cucumber 1/2 Cucumber 3
@tag @tag
~@tag not @tag
@foo, @bar (@foo or @bar)

So you need to replace a hook like this:

AfterStep('~@javascript') do
  ...
end

With this:

AfterStep('not @javascript') do
  ...
end

Also grep your entire project for ~@ and change it to "not @". Note that you need to quote both words if it's a shell command arg.

You will probably find this line in your config/cucumber.yml:

  std_opts = "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"

Change it to:

  std_opts = "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags 'not @wip'"

Fix step definitions

I had some errors like IndexError: index 2 out of matches.

This can have 2 causes:

  • You have a step definition that defines capture groups in its regular expression, but the block takes a different number of arguments.
  • Allegedly the Cucumber 3 parser only counts top-level regexp groups, ignoring nested capture groups (I could not confirm that).

Read more

Upgrading to Cucumber 3.0.0 on cucumber.io Show archive.org snapshot

Henning Koch
February 28, 2018Software engineer at makandra GmbH
Posted by Henning Koch to makandra dev (2018-02-28 18:30)