1

I have installed: ruby, watir-webdriver, rspec, cucumber.

I made the folder called "features". There is cucumber test "process.feature" inside it where is one feature with 1 simple scenario. There is also folder called "step_definitions" inside "features" where is ruby file process.rb. I try to run the test writing "cucumber process.feature" into the command line, but it says that steps are undefined: 1 scenario (1 undefined), 3 steps (3 undefined).

Could you please tell me what I am missing?

process.feature:

Feature:
‘User Login.’

Scenario:
Given I am logged in
When I open the process page
Then I see the details page

process.rb

Given /^I am logged in$/ do
b = Watir::Browser.new
b.goto 'http://star.teepub:000/star-web/'

code = '48702'
password = 'test'

b.text_field(:id => 'j_username').set code
b.text_field(:id => 'j_password').set password
b.link(:id => 'loginBtn').click
end

When /^I open the process page$/ do
pending

end

Then /^I see the details page$/ do
pending
end
2
  • 1
    Step from your .feature file is not defined, post the content of process.feature and step_definitions/process.rb files Nov 27, 2013 at 15:09
  • @mechanicalfish it is added to the description
    – Seda
    Nov 27, 2013 at 16:32

1 Answer 1

4

Your structure looks like:

--/features
    process.feature
    ---/step_definitions
         process.rb

To run this feature type in command line:

cucumber process.feature -r step_definitions

Notice, that to run this command you have to be in feature directory. After command

cucumber

you must type path to *.feature file, for example

cucumber features/process.feature

or

cucumber my_project/features/process.feature

Also you can use tags, for example

@some_name
Feature:
‘User Login.’

Scenario:
Given I am logged in
When I open the process page
Then I see the details page

Use command

cucumber --tag @some_name

In this case features, which are tagged with @same_name, will be executed. If you place tag before Scenario and type command

cucumber --tag @some_name

again, only scenario tagged with @some_name will be executed.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.