jgarciabt
jgarciabt

Reputation: 559

calabash-android: `Cucumber::Ast` no longer exists

I'm starting with calabash and I can't make run the test. The test is very simple, just press one TextView:

Feature: Login feature
    Scenario: Given I am on the Login page 
    touch("TextView id:'com.tae.store:id/option_bag'")

But I always have the same error:

Feature: Login feature

  Scenario: Given I am on the Login page # features/my_first.feature:3
      touch("TextView id:'com.tae.store:id/option_bag'")
  `Cucumber::Ast` no longer exists. These classes have moved into the `Cucumber::Core::Ast` namespace, but may not have the same API. (RuntimeError)
  ./features/support/app_installation_hooks.rb:8:in `Before'

Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: Given I am on the Login page

1 scenario (1 failed)
0 steps
0m6.173s

I'm using Ruby 1.9.3 (I've tried also with Ruby 2.0.0).

Thanks

Upvotes: 3

Views: 2374

Answers (2)

c.bielke
c.bielke

Reputation: 86

I encountered this issue a couple of times while trying to set up Calabash and Cucumber. I found the issue had to do with the version of the Cucumber gem that I was using. Several different sources mentioned that the newer Calabash gems don't work with beta Cucumber releases (reference: https://github.com/calabash/calabash-android/issues/479)

To solve this, I installed an older cucumber gem and removed the newer one

gem install cucumber -v 1.3.17
gem uninstall cucumber -v 2.0.0.beta.3

After doing so, I was able to run my tests without errors popping up. Hopefully this helps someone else as well.

Upvotes: 7

kjuri
kjuri

Reputation: 158

If I am not wrong, you are misunderstanding the structure of Calabash tests. Here is how it should look like:

In file features/my_first.feature (this is the file where you put your user story)

Feature: Login feature
  Scenario: Check login page
    Given I am on the Login page

step_definitions/steps.rb (this is the file where you are defining steps used in *.feature files)

Given /^I am on the Login page$/ do
  touch "TextView id:'option_bag'"
end

I recommend you to read calabash-android wiki here: https://github.com/calabash/calabash-android and Cucumber Book: https://pragprog.com/book/hwcuc/the-cucumber-book :)

Upvotes: 1

Related Questions