1

I am new to Ruby/Calabash and managed to set a dedicated calabash automation framework for ios with a page object model pattern and its running successfully.

I want to extend the same framework for android too. I created a dedicated folder for ios and android inside features folder and thought of having their respective page objects inside those folder.

But when I ran calabash-android, calabash finds a similar page class exists in ios folder and started throwing the error message. I want to follow same naming convention for ios and android pages without having this name-clash. Is it possible?

    superclass mismatch for class AuthenticationPage (TypeError) 
    /Users/MACUSER/Documents/Automation/features/ios/pages/authentication_page. rb:5:in `<top (required)>'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
   /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:180:in `load_file'
  /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `each'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:184:in `load_step_definitions'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:42:in `run!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
 /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top  (required)>'
 /usr/bin/cucumber:23:in `load'
 /usr/bin/cucumber:23:in `<main>'
Vinee
  • 402
  • 2
  • 10
  • 27

3 Answers3

1

Based on your description of the issue, it is not clear what the problem is. I think it would help if you added more details about your folder structures and files.

But as you have not mentioned profiles as all I am suspecting that you are not using an .yml file.

When you execute your tests you should define what profile you are running and have one for iOS and one for Android. For each profile you will define what folders to include.

Like this

android: PLATFORM=android RESET_BETWEEN_SCENARIOS=1 -r features/support -r features/android/support -r features/android/helpers -r features/step_definitions -r features/android/pages/

And then when you execute the tests you define for what profile

calabash-android run path_to.apk -p android features/login.feature

If you have not already you should look at either Xamarin cross-platform tutorial or on the Github page for same

Lasse
  • 1,153
  • 1
  • 10
  • 21
  • Thanks for your response. But, I am using .yml file and conigured my .yml as mentioned above only. My problem is I created independant folder for page object in ios and android folder. But getting a compilation error if ruby finds the same class present in two different directories and i am not sure how to get around that. Is that clear , if not please let me know :( – Vinee Apr 13 '15 at 08:48
  • Could you perhaps add some text on how your folder structure is? You should have different folders for each platform. Like /features/android/pages/ and /features/ios/pages/. How do you define the classes on the two platforms? are you using ABAse and IBase? – Lasse Apr 13 '15 at 11:58
0

had similar problem, solved by adding exclude option "--exclude ios" to android profile in config/cucumber.yml file (and "--exclude android" for ios respectively)

---
android: PLATFORM=android  --exclude ios -r features/support -r features/android -r features/step_definitions -r features/android/pages


ios: PLATFORM=ios APP_BUNDLE_PATH=path_to_your.app --exclude android -r features/support -r features/ios/support -r features/ios/helpers -r features/step_definitions -r features/ios/pages

seems to be cucumber bug, because according to cucumber docs -r switch should prevent loading all files except those specified explicitly

-r, --require LIBRARY|DIR        Require files before executing the features. If this
                                 option is not specified, all *.rb files that are
                                 siblings or below the features will be loaded auto-
                                 matically. Automatic loading is disabled when this
                                 option is specified, and all loading becomes explicit.
                                 Files under directories named "support" are always
                                 loaded first.

...

-e, --exclude PATTERN            Don't run feature files or require ruby files matching PATTERN
ludenus
  • 1,161
  • 17
  • 30
0

Xamarin is saying you should give the profile and the config in the command --profile ios --config=config/cucumber.yml. See this:

test-cloud submit prebuilt/Moda-cal.ipa  93dbwrmwrb0d65099640f23 --devices 99dwdhw846 --series "ip7" --locale "en_US" --app-name "Moda" --user gunesmes@gmail.com --profile ios --config=config/cucumber.yml

test-cloud submit prebuilt/Moda.apk  93dbwrmwrb06sfu440f23 --devices 9933nb846 --series "nex" --locale "en_US" --app-name "Moda" --user gunesmes@gmail.com --profile android --config=config/cucumber.yml
Mesut GUNES
  • 7,089
  • 2
  • 32
  • 49