Page MenuHomePhabricator

Cucumber linter should run for all repositories that contain Cucumber code
Closed, DeclinedPublic

Description

Cucumber has built in syntax check:

$ cucumber -h
(...)

-d, --dry-run                    Invokes formatters without executing the steps.
                                 This also omits the loading of your support/env.rb file if it exists.

(...)

We should run it for all repositories that contain Cucumber code[1].

1: https://github.com/wikimedia/mediawiki-selenium


Version: wmf-deployment
Severity: normal
Whiteboard: zfilipin

Details

Reference
bz56251

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:12 AM
bzimport set Reference to bz56251.
bzimport added a subscriber: Unknown Object (MLST).

UniversalLanguageSelector/tests/browser$ cucumber --dry-run

Using the default profile...

42 scenarios (42 skipped)
317 steps (317 skipped)
0m0.600s

"cucumber -d" runs fine for:

browsertests, Flow, UniversalLanguageSelector

and fails with an error message similar to this for the rest of the repos:

$ cucumber -d
uninitialized constant ArticlePage::PageObject (NameError)
/home/z/project/CirrusSearch/tests/browser/features/support/pages/article_page.rb:2:in `<class:ArticlePage>'
/home/z/project/CirrusSearch/tests/browser/features/support/pages/article_page.rb:1:in `<top (required)>'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/rb_support/rb_language.rb:122:in `load'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/rb_support/rb_language.rb:122:in `load_code_file'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime.rb:183:in `load_step_definitions'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/runtime.rb:42:in `run!'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/lib/cucumber/cli/main.rb:47:in `execute!'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/gems/cucumber-1.3.8/bin/cucumber:13:in `<top (required)>'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/bin/cucumber:23:in `load'
/home/z/.rvm/gems/ruby-2.0.0-p247@CirrusSearch/bin/cucumber:23:in `<main>'

As the documentation says, -d option does not load env.rb file, and that causes the problem.

I do not know why it works fine for some repositories.

Looks like page-object gem is not required in some repos. This works for all repos (page-object gem has to be installed):

cucumber -d -r page-object

Don't you need to use bundler to run it ? Supposedly page object would be provided so:

bundle install
bundle exec cucumber -d

What is the use case to run that command ? The browser test jobs run cucumber already so that sounds redundant to me.

hashar lowered the priority of this task from Low to Lowest.Oct 6 2015, 12:10 PM
hashar added a subscriber: zeljkofilipin.

@zeljkofilipin should we just decline this task?

Was just wondering since that task has been opened back in October 2013. I guess the cucumber linting can be added to a future rake test entry point.

I have stumbled upon this task while cleaning up browser tests board. I was forgotten for a while, hence no activity. :(

zeljkofilipin raised the priority of this task from Lowest to Medium.

We have a Rakefile entry point now ( T117993 ). So the cucumber linter can be added as needed.

hashar lowered the priority of this task from Medium to Low.Oct 11 2016, 11:38 AM

This is 2+years old task. The main use case for cucumber is for the selenium tests and we are migrating to webdriver.io / Mocha