Search code examples
ioscucumberfrank

Cucumber not identifying steps definition


I have written a feature and a step definition. However, cucumber is not identifying the step definition.

my_first.feature

Feature:
  As an iOS developer
  I want to have a sample feature file
  So I can see what my next step is in the wonderful world of Frank/Cucumber testing

Scenario: 
    Launching the app

Given I launch the app

The step definition file is in step_definitions folder and is named as launch_steps.rb. The code is :

def app_path
  ENV['APP_BUNDLE_PATH'] || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH)
end

Given /^I launch the app$/ do
  launch_app app_path
end

However, when I run cucumber in terminal, I do not get proper output. Following is the log from terminal

features git:(frank) ✗ cucumber my_first.feature
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Feature: 
  As an iOS developer
  I want to have a sample feature file
  So I can see what my next step is in the wonderful world of Frank/Cucumber testing

  Scenario:                # my_first.feature:6
      Launching the app
    Given I launch the app # my_first.feature:9

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

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

Given(/^I launch the app$/) 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.

I am trying to learn cucumber and as first feature, I am trying to launch the app. Thus, my expectation is that app would launch with this feature.

PS: I have not executed app from XCode.


Solution

  • I have found the answer. We need to run this from a level up in directory.