lundi 26 février 2018

Cucumber Feature file does not see "step" file

This is only my second day with Cucumber. I have created the test file and the step file. Cucumber starts up and runs, but it continues to tell me to write a step file. Is there a naming convention for the files, or do I need to point to the step file somehow? I am trying to follow a tutorial.

Thank you

Cucumber: Version 3.1.0

Ruby version: 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

rspec-core 3.7.1

 test/features/step_definitions/test_step.rb


require 'watir'
require 'colorize'

browser = Watir::Browser.new


Given(/^I am on Guru99 Demo Page$/) do

  browser.goto "http://demo.guru99.com"

 end


 When (/^Enter blank details for login$/)do
   browser.text_field(:name,"emailid").set (" ")
   browser.button(:name,"btnLogin").click 
 end

 Then (/^Show error message$/)do
   puts 'Email is Required!'.red
   browser.close
 end

And my Test File:

test/features/test.feature

Feature: guru99 Demopage Login
 In order to Login in Demopage we have to enter login details


 Scenario: Register On Guru99 Demopage without email

 Given  I am on the Guru99 homepage

 When enter blank details for Register

 Then error email shown

Here the results in the console when I run Cucumber.

ZeroCalms-MacBook-Pro:features ZeroCalm$ cucumber test.feature

Feature: guru99 Demopage Login
 In order to Login in Demopage we have to enter login details

  Scenario: Register On Guru99 Demopage without email # test.feature:5
    Given I am on the Guru99 homepage                 # test.feature:7
    When enter blank details for Register             # test.feature:9
    Then error email shown                            # test.feature:11

1 scenario (1 undefined)
3 steps (3 undefined)
0m0.026s

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

Given("I am on the Guru{int} homepage") do |int|
  pending # Write code here that turns the phrase above into concrete 
  actions
end

When("enter blank details for Register") do
  pending # Write code here that turns the phrase above into concrete 
  actions
end

Then("error email shown") do
  pending # Write code here that turns the phrase above into concrete 
  actions
end

Aucun commentaire:

Enregistrer un commentaire