Help Getting Started with Cucumber

207 views
Skip to first unread message

John Lopez

unread,
Aug 2, 2011, 1:05:39 PM8/2/11
to Frank
Hello,

Currently I am trying to familiarize myself with Frank. I have setup
cucumber and followed all the steps in the tutorial up to the middle
of step #8. I created the file tutorial_steps.rb and copied and pasted
the snippet of code in the tutorial over the "pending" line. Currently
I am having the following error:

Given I launch the app # step_definitions/tutorial_steps.rb:1
undefined local variable or method `launch_app_in_simulator' for
#<Object:0x1011a1970> (NameError)
./step_definitions/tutorial_steps.rb:2:in `/^I launch the app$/'
my_first.feature:8:in `Given I launch the app'

Let me just say that I am brand new to Cucumber, Ruby, and also Frank.
Any ideas on what I could do to fix this?

Thanks,
John

Stewart Gleadow

unread,
Aug 2, 2011, 11:28:13 PM8/2/11
to frank-...@googlegroups.com
Looks like you don't have the method 'launch_app_in_simulator' in features/support/env.rb

If you look at the frank-skeleton that you can create after you've installed the frank-cucumber gem it should have an example of the method that launched the app in the simulator.

I have a step in features/general_steps.rb:

Given /^I launch the app$/ do
launch_the_app
end

And then define that method in a Ruby file under the support directory.

- Stew

John Lopez

unread,
Aug 3, 2011, 10:26:25 AM8/3/11
to Frank
Are you referring to the file "launch_steps.rb" that is located within
the "step_definitions" directory?

John Lopez

unread,
Aug 3, 2011, 11:31:57 AM8/3/11
to Frank
Just a quick heads up with where I am at. I ended up using the
launch_steps.rb file because it seemed to launch the app close to
correctly. Currently, in my env.rb file I initialized the
APP_BUNDLE_PATH as follows:

APP_BUNDLE_PATH = File.dirname(__FILE__) + "/Users/Johnny/vokal/
FanFueled-iOS/build/Debug-iphonesimulator/FanFueled copy.app"

Whenever I try to launch the app, I have to first build it from Xcode,
then I run the command, "cucumber my_first_feature.rb", on my screen
it spells out "FR" and simultaneously closes the app in the simulator.
When I reopen the app inside of the simulator, the remainder of
"FRANK!" gets spelled out on my screen and the tutorial feature then
runs. Can somebody help me fix this issue? Ideally, I would like to
run the cucumber command and then have everything run without me
having to do any extra steps, such as click the app icon within the
simulator. Any help would be greatly appreciated!

Thanks,
John

Pete Hodgson

unread,
Aug 4, 2011, 8:17:24 AM8/4/11
to frank-...@googlegroups.com
Hi John,

When you the app freezes after FR, can you try leaving the script for a minute and see if it manages to relaunch the app and get going again? Starting the app can be slightly flaky, and there are several levels of timeouts which try to workaound various lockups. It could be that one of those timeouts will recover from the state the simulator gets in.

Cheers,
Pete

John Lopez

unread,
Aug 4, 2011, 10:28:24 AM8/4/11
to Frank
Pete,

When I try to launch the app from the command line, this is what I
get:

PING
FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PING
FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PING FAILED!!!!!!!!!!!
PING
FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Given I launch the app # step_definitions/
launch_steps.rb:1
Encountered 1 timeouts while launching the app.
Encountered 2 timeouts while launching the app.
Encountered 3 timeouts while launching the app.
Encountered 4 timeouts while launching the app.
Encountered 4 timeouts in a row while trying to launch the app.
(RuntimeError)
./step_definitions/launch_steps.rb:33
./step_definitions/launch_steps.rb:23:in `loop'
./step_definitions/launch_steps.rb:23:in `/^I launch the app$/'
FanFueledAutomatedTesting.feature:8:in `Given I launch the app'

The way that I have been running my scripts is a little different.
First, I have to launch the project in the simulator. Then, I run my
cucumber command. The app then back's out of the app (as if it were
touching the home screen). Upon seeing the home screen on the
simulator, I relaunch the app by pressing it's icon within the
simulator. By this time, "FRANK!" gets spelled and the script starts.
When it is time for the next scenario to start running, the app once
again returns to the home screen. And yet again, I have to press the
app's icon in order for the scenarios to start running. If I were to
let my script continue running without manually launching it from the
simulator, here is what I see:

FRAN Given I launch the app # step_definitions/
launch_steps.rb:1
Encountered 1 timeouts while launching the app.
Encountered 2 timeouts while launching the app.
Encountered 3 timeouts while launching the app.
Encountered 4 timeouts while launching the app.
Encountered 4 timeouts in a row while trying to launch the app.
(RuntimeError)
./step_definitions/launch_steps.rb:33
./step_definitions/launch_steps.rb:23:in `loop'
./step_definitions/launch_steps.rb:23:in `/^I launch the app$/'
FanFueledAutomatedTesting.feature:16:in `Given I launch the app'
When I touch "btn search" # frank-cucumber-0.6.1/lib/
frank-cucumber/core_frank_steps.rb:178
Then I wait to see "Search" # frank-cucumber-0.6.1/lib/
frank-cucumber/core_frank_steps.rb:6
When I touch "Cancel" # frank-cucumber-0.6.1/lib/
frank-cucumber/core_frank_steps.rb:178
Then I wait to see "btn search" # frank-cucumber-0.6.1/lib/
frank-cucumber/core_frank_steps.rb:6

I do believe that it has to do with my "Given I launch the app" step.
I have just been using the default "launch_steps.rb" file located
within features/step_definitions/launch_steps.rb. As stated above, I
set the APP_BUNDLE_PATH withiin the env.rb file. My APP_BUNDLE_PATH
could have been initialized incorrectly. I read on another post that
Xcode puts the build's in a different folder than where the app is
stored, however when I try to find a build I am unsuccessful. Any
ideas?

Once again, I appreciate all the help and effort that you both have
provided. Thank you so much,

John

On Aug 4, 7:17 am, Pete Hodgson <phodg...@thoughtworks.com> wrote:
> Hi John,
>
> When you the app freezes after FR, can you try leaving the script for a
> minute and see if it manages to relaunch the app and get going again?
> Starting the app can be slightly flaky, and there are several levels of
> timeouts which try to workaound various lockups. It could be that one of
> those timeouts will recover from the state the simulator gets in.
>
> Cheers,
> Pete
>

John Lopez

unread,
Aug 4, 2011, 11:23:15 AM8/4/11
to Frank
I fixed the issue. All that was happening was that my APP_BUNDLE_PATH
was initialized incorrectly.

Thank you for the help.

On Aug 4, 9:28 am, John Lopez <johnny.lopez...@gmail.com> wrote:
> Pete,
>
> When I try to launch the app from the command line, this is what Iget:
>
> PING
> FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> PING
> FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> PING FAILED!!!!!!!!!!!
> PING
> FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> Given I launch the app                       # step_definitions/
> launch_steps.rb:1
>       Encountered 1 timeouts while launching the app.
>       Encountered 2 timeouts while launching the app.
>       Encountered 3 timeouts while launching the app.
>       Encountered 4 timeouts while launching the app.
>       Encountered 4 timeouts in a row while trying to launch the app.
> (RuntimeError)
>       ./step_definitions/launch_steps.rb:33
>       ./step_definitions/launch_steps.rb:23:in `loop'
>       ./step_definitions/launch_steps.rb:23:in `/^I launch the app$/'
>       FanFueledAutomatedTesting.feature:8:in `Given I launch the app'
>
> The way that I have been running my scripts is a little different.
> First, I have to launch the project in the simulator. Then, I run mycucumbercommand. The app then back's out of the app (as if it were
> > minute and see if it manages to relaunch the app andgetgoing again?
> > Starting the app can be slightly flaky, and there are several levels of
> > timeouts which try to workaound various lockups. It could be that one of
> > those timeouts will recover from the state the simulator gets in.
>
> > Cheers,
> > Pete
>
> > On Wed, Aug 3, 2011 at 11:31 AM, John Lopez <johnny.lopez...@gmail.com>wrote:
>
> > > Just a quick heads up with where I am at. I ended up using the
> > > launch_steps.rb file because it seemed to launch the app close to
> > > correctly. Currently, in my env.rb file I initialized the
> > > APP_BUNDLE_PATH as follows:
>
> > > APP_BUNDLE_PATH = File.dirname(__FILE__) + "/Users/Johnny/vokal/
> > > FanFueled-iOS/build/Debug-iphonesimulator/FanFueled copy.app"
>
> > > Whenever I try to launch the app, I have to first build it from Xcode,
> > > then I run the command, "cucumbermy_first_feature.rb", on my screen
> > > it spells out "FR" and simultaneously closes the app in the simulator.
> > > When I reopen the app inside of the simulator, the remainder of
> > > "FRANK!" gets spelled out on my screen and the tutorial feature then
> > > runs. Can somebody help me fix this issue? Ideally, I would like to
> > > run thecucumbercommand and then have everything run without me
> > > having to do any extra steps, such as click the app icon within the
> > > simulator. Any help would be greatly appreciated!
>
> > > Thanks,
> > > John
>
> > > On Aug 3, 9:26 am, John Lopez <johnny.lopez...@gmail.com> wrote:
> > > > Are you referring to the file "launch_steps.rb" that is located within
> > > > the "step_definitions" directory?
>
> > > > On Aug 2, 10:28 pm, Stewart Gleadow <sglea...@gmail.com> wrote:
>
> > > > > Looks like you don't have the method 'launch_app_in_simulator' in
> > > features/support/env.rb
>
> > > > > If you look at the frank-skeleton that you can create after you've
> > > installed the frank-cucumbergem it should have an example of the method
> > > that launched the app in the simulator.
>
> > > > > I have a step in features/general_steps.rb:
>
> > > > > Given /^I launch the app$/ do
> > > > >   launch_the_app
> > > > > end
>
> > > > > And then define that method in a Ruby file under the support directory.
>
> > > > > - Stew
>
> > > > > On 03/08/2011, at 3:05 AM, John Lopez wrote:
>
> > > > > > Hello,
>
> > > > > > Currently I am trying to familiarize myself with Frank. I have setup
> > > > > >cucumberand followed all the steps in the tutorial up to the middle
> > > > > > of step #8. I created the file tutorial_steps.rb and copied and
> > > pasted
> > > > > > the snippet of code in the tutorial over the "pending" line.
> > > Currently
> > > > > > I am having the following error:
>
> > > > > > Given I launch the app     # step_definitions/tutorial_steps.rb:1
> > > > > >     undefined local variable or method `launch_app_in_simulator' for
> > > > > > #<Object:0x1011a1970> (NameError)
> > > > > >     ./step_definitions/tutorial_steps.rb:2:in `/^I launch the app$/'
> > > > > >     my_first.feature:8:in `Given I launch the app'
>
> > > > > > Let me just say that I am brand new toCucumber, Ruby, and also

Robert Duke

unread,
Aug 8, 2011, 8:16:45 PM8/8/11
to Frank
Hello Pete,

This is @secondfiddleapp from twitter. I wanter to let you know that
I have figured out what was happening on my machine. I am using the
4.3.2 simulator, in the launch_steps.rb I put the 4.3.2 in the sdk
string which I thought made sense, but alas the iphonesim showsdks
listed:
'Simulator - iOS 3.2' (3.2)
/Developer/Platforms/iPhone
'Simulator - iOS 4.0' (4.0)
/Developer/Platforms/iPhone
'Simulator - iOS 4.1' (4.1)
/Developer/Platforms/iPhone
'Simulator - iOS 4.2' (4.2)
/Developer/Platforms/iPhone
'Simulator - iOS 4.3' (4.3)
/Developer/Platforms/iPhone
As you can see 4.3.2 does not exist in this list, so it wasn't finding
the proper target. I guess you can only specify the minor version and
not the sub-minor version.

As soon as I changed:
simulator = SimLauncher::DirectClient.for_ipad_app( app_path,
sdk = '4.3.2' )
to:
simulator = SimLauncher::DirectClient.for_ipad_app( app_path,
sdk = '4.3' )

It began working as expected.

Whew, this was really starting to frustrate! Thanks for you effort
with Frank.


On Aug 4, 7:17 am, Pete Hodgson <phodg...@thoughtworks.com> wrote:
> Hi John,
>
> When you the app freezes after FR, can you try leaving the script for a
> minute and see if it manages to relaunch the app and get going again?
> Starting the app can be slightly flaky, and there are several levels of
> timeouts which try to workaound various lockups. It could be that one of
> those timeouts will recover from the state the simulator gets in.
>
> Cheers,
> Pete
>
Reply all
Reply to author
Forward
0 new messages