grosser / parallel_tests

Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
3.38k stars 495 forks source link

Cucumber Features Not Recognized as Already Defined #220

Open verdi327 opened 11 years ago

verdi327 commented 11 years ago

I'm using Rails 3.2, Cucumber-Rails, and Capybara

I have 2 feature files currently. Both pass when I run cucumber

I added the parallel_tests gem. My tests are selenium browser tests and do not require a db so I skipped the rake parallel:create and rake parallel:prepare commands. Now when I run rake parallel:features the tests attempt to run but act as if I have not written step definitions for my features.

I get the following output:

8 processes for 2 features, ~ 0 features per process @selenium @selenium @external Feature: Testing different webpages

Scenario: Around the world # features/test/external.feature:4 Given I am checking out many pages # features/test/external.feature:5 Undefined step: "I am checking out many pages" (Cucumber::Undefined) features/test/external.feature:5:in `Given I am checking out many pages'

1 scenario (1 undefined) 1 step (1 undefined) 0m0.001s

You can implement step definitions for undefined steps with these snippets:

Given(/^I am checking out many pages$/) do pending # express the regexp above with the code you wish you had end

If you want snippets in a different programming language, just make sure a file with the appropriate file extension exists where cucumber looks for step definitions.

@tumblr Feature: Tumblr Example

Scenario: New Tumblr Account # features/test/homepage.feature:4 Given I am on "https://www.tumblr.com" # features/test/homepage.feature:5 Undefined step: "I am on "https://www.tumblr.com"" (Cucumber::Undefined) features/test/homepage.feature:5:in Given I am on "https://www.tumblr.com"' When I signup for a new account # features/test/homepage.feature:6 Undefined step: "I signup for a new account" (Cucumber::Undefined) features/test/homepage.feature:6:inWhen I signup for a new account'

1 scenario (1 undefined) 2 steps (2 undefined) 0m0.001s

You can implement step definitions for undefined steps with these snippets:

Given(/^I am on "(.*?)"$/) do |arg1| pending # express the regexp above with the code you wish you had end

When(/^I signup for a new account$/) do pending # express the regexp above with the code you wish you had end

If you want snippets in a different programming language, just make sure a file with the appropriate file extension exists where cucumber looks for step definitions.

2 scenarios (2 undefined) 3 steps (3 undefined)

Took 1.070934 seconds Tests Failed

grosser commented 11 years ago

Can you add a failing test or make an failing example project ?

parallel_tests should also print the command it's running, maybe this helps further debugging this

verdi327 commented 11 years ago

Thanks for the reply! Make a failing test? Do you mean make a test that fails when I run cucumber? As it stands now, both of the example scenarios that I created fail when I run rake parallel:features

grosser commented 11 years ago

I meant make a failing test for parallel_tests or an example project that shows this error.

triangletodd commented 11 years ago

@verdi327 you should create a cucumber.yml file inside your project (if you don't already have one). Create a parallel profile and make sure it has appended to it '-r features'.

This did the trick for me.

verdi327 commented 11 years ago

Thanks man

reach2jeyan commented 7 years ago

@verdi327 I am now facing the same issue. Somehow right in the morning suddenly, this cucumber, started to act weird the same way you have mentioned.

Please let me know, what work around you did to fix it.