Use of ABase results in "uninitialized constant Calabash (NameError)"

745 views
Skip to first unread message

Morten Gregersen

unread,
Aug 26, 2014, 7:28:58 AM8/26/14
to calabash...@googlegroups.com

I'm trying to use the ABase class as a base class for my screen objects. I've created my own base class for my screen object which inherits from ABase:


abd_base.rb

require 'calabash-android/abase'

class ABDBase < Calabash::ABase

   
#some general stuff for all screens
end


When I run my features I get the folllowing error:


vbus-imac:Calabash bdumgr$ ANDROID_HOME=/Users/bdumgr/Downloads/android-sdk-macosx calabash-android run MyAwesome.apk -v -r android/*

2014-08-26 12:32:04 - JDK found on PATH.

2014-08-26 12:32:04 - Android SDK found at: /Users/bdumgr/Downloads/android-sdk-macosx

2014-08-26 12:32:04 - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -S cucumber -v -r android/abd_base.rb android/abd_signing_base.rb android/screens android/support MAIN_ACTIVITY=my.awesome.MainActivity APP_PATH="/Users/bdumgr/Desktop/Calabash/MyAwesome.apk" TEST_APP_PATH="test_servers/9d50fca29b39a78705d82cecd025c7e5_0.5.1.apk"

Code:

  * android/abd_base.rb

uninitialized constant Calabash (NameError)

/Library/Ruby/Gems/2.0.0/gems/calabash-android-0.5.1/lib/calabash-android/abase.rb:1:in `<top (required)>'

/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require'

/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'

/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'

/Users/bdumgr/Desktop/Calabash/android/abd_base.rb:1:in `<top (required)>'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/rb_support/rb_language.rb:95:in `load'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime/support_code.rb:180:in `load_file'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime/support_code.rb:82:in `each'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime/support_code.rb:82:in `load_files!'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime.rb:184:in `load_step_definitions'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/runtime.rb:42:in `run!'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/lib/cucumber/cli/main.rb:47:in `execute!'

/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.16/bin/cucumber:13:in `<top (required)>'

/usr/bin/cucumber:23:in `load'

/usr/bin/cucumber:23:in `<main>'


It looks like it doesn't understand "include Calabash::Android::Operations" in "class Calabash::ABase".


Do I need to do anything special to use ABase?


My project structure is as follows:


Calabash

|_android

| |_screens

| | |_menu_screen.rb

| |_support

| | |_//default support files from calabash-android

| |_abd_base.rb

| |_abd_signing_base.rb

|_features

| |_step_definitions

| | |_//default and custom step definitions

| |_//some features

|_test_servers

| |_//generated test servers


My gems are up to date. Here is a list of my installed gems:


*** LOCAL GEMS ***


activesupport (4.1.5, 3.2.19)

awesome_print (1.2.0)

bigdecimal (1.2.5, 1.2.0)

builder (3.2.2)

bundler (1.7.2, 1.7.0, 1.6.5, 1.6.3)

calabash (1.2.1)

calabash-android (0.5.1, 0.4.21)

calabash-common (0.0.1)

calabash-cucumber (0.9.169)

CFPropertyList (2.2.8, 2.2.0)

claide (0.6.1)

cocoapods (0.33.1)

cocoapods-core (0.33.1)

cocoapods-downloader (0.6.1)

cocoapods-plugins (0.2.0)

cocoapods-trunk (0.1.4)

cocoapods-try (0.3.0)

colored (1.2)

cucumber (1.3.16, 1.3.15)

debase (0.0.9)

debugger-ruby_core_source (1.3.5)

diff-lcs (1.2.5)

edn (1.0.6)

escape (0.0.4)

fuzzy_match (2.1.0, 2.0.4)

geocoder (1.2.4, 1.2.3, 1.1.9)

gherkin (2.12.2)

httpclient (2.4.0, 2.3.4.1)

i18n (0.6.11)

io-console (0.4.2)

json (1.8.1, 1.7.7)

json_pure (1.8.1)

libxml-ruby (2.7.0, 2.6.0)

mime-types (2.3, 1.25.1)

mini_portile (0.6.1, 0.6.0)

minitest (5.4.0, 5.3.5, 4.3.2)

multi_json (1.10.1)

multi_test (0.1.1)

nap (0.8.0)

netrc (0.7.7)

nokogiri (1.5.6)

open4 (1.3.4)

power_assert (0.1.3)

psych (2.0.5, 2.0.0)

rack (1.5.2)

rack-protection (1.5.3)

rake (10.3.2, 0.9.6)

rdoc (4.1.1, 4.0.0)

rest-client (1.7.2, 1.6.7)

retriable (1.4.1, 1.3.3.1)

ruby-debug-ide (0.4.23.beta1)

rubygems-update (2.4.1)

rubyzip (1.1.6, 0.9.9)

run_loop (0.2.1)

sim_launcher (0.4.11)

sinatra (1.4.5)

slowhandcuke (0.0.3)

sqlite3 (1.3.9, 1.3.7)

test-unit (3.0.1, 2.5.5, 2.0.0.0)

thor (0.19.1)

thread_safe (0.3.4)

tilt (2.0.1, 1.4.1)

tzinfo (1.2.2)

xamarin-test-cloud (0.9.37, 0.9.35, 0.9.33)

xcodeproj (0.18.0, 0.17.0)

Kristina Stemikovskaya

unread,
May 8, 2015, 11:32:18 AM5/8/15
to calabash...@googlegroups.com
Hi Morten! Have you found any solution? I have the same issue while implementing Page Object Model. Thought it could be a Ruby issue, but updating to 2.2 didn´t work 

Morten Gregersen

unread,
May 11, 2015, 2:12:32 AM5/11/15
to calabash...@googlegroups.com
Hi Kristina

It works for me now. I don't remember doing something special for this to work.

- Morten

tobias....@xamarin.com

unread,
May 11, 2015, 3:57:21 AM5/11/15
to calabash...@googlegroups.com, kristi...@enigmedia.es
This is most likely an indication that your env does not properly load Calabash-Android. What is the contents of features/support/env.rb ? 

Kristina Stemikovskaya

unread,
May 11, 2015, 5:11:04 AM5/11/15
to calabash...@googlegroups.com, kristi...@enigmedia.es
Hi Tobias! 

I found the cause of the error, I forgot to include 

require 'calabash-android/operations'

in features/android/support/env.rb , only had  require 'calabash-cucumber/operations'

Now everything work fine, thanks! 
Reply all
Reply to author
Forward
0 new messages