Use third party ruby library in my calabash tests

27 views
Skip to first unread message

Leem fin

unread,
Sep 1, 2016, 5:18:39 AM9/1/16
to calabash-android

My calabash android test project has the following structure:


-- myApp.apk
-- features (directory)
          |-- my-feature-1-file-name.feature
          |-- step_definitions (directory)
          |      calabash_steps.rb
          |-- support (directory)
          |      thirdPartyLib.rb

My calabash test steps need to call function from a third party library thirdPartyLib.rb. As you see above, under features/ directory, I have a support/ directory, there, I have a thirdPartyLib.rb ruby file.


Inside thirdPartyLib.rb , the 1st line of code is this:


require 'jmespath'
...

When I go to my project root, and run the test by command calabash-android run myApp.apk DEBUG=1 , I get the following error:


DEBUG: Setting Android SDK location to $ANDROID_HOME
DEBUG: Android SDK location set to '/Users/John/Library/Android/sdk'
DEBUG: Set aapt path to '/Users/John/Library/Android/sdk/build-tools/23.0.3/aapt'
DEBUG: Set zipalign path to '/Users/John/Library/Android/sdk/build-tools/23.0.3/zipalign'
DEBUG: Set adb path to '/Users/John/Library/Android/sdk/platform-tools/adb'
DEBUG: Set android jar path to '/Users/John/Library/Android/sdk/platforms/android-24/android.jar'
DEBUG: Setting Java SDK location to $JAVA_HOME
DEBUG: Java SDK location set to '/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home'
DEBUG: Found java on PATH
DEBUG: Set java path to '/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java'
DEBUG: Found keytool on PATH
DEBUG: Set keytool path to '/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/keytool'
DEBUG: Found jarsigner on PATH
DEBUG: Set jarsigner path to '/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/jarsigner'
cannot load such file -- jmespath (LoadError)

/Users/John/.calabash/sandbox/Rubies/2.1.6-p336/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/John/.calabash/sandbox/Rubies/2.1.6-p336/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/John/my-calabash-test/features/support/thirdPartyLib.rb:1:in `<top (required)>'
...

So, it is a loading error, it looks like calabash-android cannot load file jmespath (LoadError)that is declared in thirdPartLib.rb . How can I get rid of this error? (By the way I need to zip my calabash test and upload to cloud service to run it)

Reply all
Reply to author
Forward
0 new messages