I am new here. I hope that question precision will be right. I did not found the answer neither here nor this solution helped.
Introduction:
I have created an automated test of web app using Ruby/Watir/Cucumber in RubyMine. Feature works fine - the test is passed (steps definitions are OK). Unfortunately I cannot run the same feature in NetBeans. It seems like I do have problem with linking steps with their steps definitions.
Relevant environment/tools used:
Windows 7
NetBeans IDE 8.0
NenBeans plugin: Cetriolo v 1.0
NetBeans plugin: Cucumber Features v 1.8.2
Ruby 1.9.3
GEM: watir-webdriver 0.6.10
GEM: cucumber 1.3.15
GEM: Page-object 1.0
Project structure:
Picture_of_project_structure
Feature looks like:
1 Feature: Adoptin Puppies
2
3 As a puppy lover
4 I want to adopt puppies
5 So they can chew my furniture
6
7 Background:
8 Given I an on the adoption site
9
10 Scenario: Adopting one puppy
11 When I click the View Details of puppy 1 button
12 And I click the Adopt Me button
13 And I click the Complete the Adoption button
/..../
Problem description:
In the feature file Given, When, And, And,.. are underlined and there is a comment that there is no step definition for those steps.
There is no implementations seen in the Steps window (enabled by plugin):
Image_of_step_window_without_step_implementation
When I run the adopting_puppies.feature using Cucumber icon (enabled by plugin) then Background and step Given I an on the adoption site is executed. I mean - web browser opens and goes to the correct address and then closes (this happens 4 times - once for every of 4 scenarios). The output is:
Output of running [cmd, /C, cucumber, -r, C:\Users\t4f\NetBeansProjects\test_puppies_copy\lib\features, C:\Users\t4f\NetBeansProjects\test_puppies_copy\lib\features\adopting_puppies.feature, -s] is:
--- START ---
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
Feature: Adoptin Puppies
As a puppy lover
I want to adopt puppies
So they can chew my furniture
Background:
Given I an on the adoption site
dupa
Scenario: Adopting one puppy
When I click the View Details of puppy 1 button
And I click the Adopt Me button
/...steps written here like in feature file.../
4 scenarios (4 undefined)
43 steps (30 skipped, 9 undefined, 4 passed)
2m35.034s
You can implement step definitions for undefined steps with these snippets:
When(/^I click the View Details of puppy (\d+) button$/) do |arg1|
pending # express the regexp above with the code you wish you had
end
When I follow this answer and run the feature in cmd window using:
cucumber lib/features/adopting_puppies.feature -r lib/features
the result is the same (browser opened, page visited, browser closed) but at least I can see that adopting_puppy_steps.rb is 'used' (output is the same, but there are comments after each line of otuput):
/.../
Background: # lib\features\adopting_puppies.feature:7
Given I an on the adoption site # lib/features/step_definitions/adopting_pup
py_steps.rb:1
dupa
Scenario: Adopting one puppy # lib\features\adoptin
g_puppies.feature:10
When I click the View Details of puppy 1 button # lib\features\adoptin
g_puppies.feature:11
And I click the Adopt Me button # lib/features/step_de
finitions/adopting_puppy_steps.rb:17
/.../
Question/request:
Can anyone, please, tell me why with NetBeans the step definitions cannot be recognized?
Since 'Given' is executed successfuly, and RubyMine does not have problems with all the steps, I am confused (especially cause I am new to all this Ruby/Watir/Cucumber stuff.
My RubyMine evaluation ends within 5 days and I still want to learn :)
Check out what has happened when I copied some other feature using the same steps: [Two_features](http://s24.postimg.org/g6xasyoo5/two_files.png). Test_puppies got the Navigator content and is underlined. Adopting_puppies_with_checking_shopping_card does not have Navigator content (not seen on the picture), but WORKS! There are no differences I can find, but will sit on this issue during the weekend. – user3673885 Jun 19 '14 at 10:26