Search code examples
androidrubytestingcalabash

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


Solution

  • 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.