My app doesn’t start when I run the command cucumber

Hello guys !

I hope you are fine. I am searching here for a problem that I had for the second time when I tried to run cucumber and calabash in a PC.

First, I got the installation of cucumber framework on the app, but when I run the command: cucumber. The splash screen appears a lot of times, but the app doesn’t start. It seems that the cucumber are trying to open the app and something is blocking.

After you have all configured, this problem won’t happen again. I am trying to reproduce the problem in my PC and since this already is configured the problem didn’t happen again. For this reason I think that it is some permission or update type of problem.

  1. Look on the launch.rb file inside the folder features/support if the line APP_BUNDLE_PATH is commented with # in front of. (Because this just have to be used as the last case if the app doesn’t start). There should generally be no need to set ANY environment variables for default project setups. APP_BUNDLE_PATH should only be set if Calabash is not able to detect it correctly. SDK_VERSION should only be set if you don’t want to run in the latest iOS simulator version. OS should never need to need to be set.
  2. Check if the cucumber is installed in the app:
    calabash-ios check PATH_TO_IPA_OR_APP

     

  3. Disable your firewall: https://groups.google.com/forum/#!msg/calabash-ios/AXrXhGB2_mc/wIzR16Sm2IEJ
  4. Try running with sudo.
  5. Verify if your permission is of admin and what is the user that you is trying to run cucumber (must be the same)
  6. Verify if you have permission to access the page of the project and the .app with the user that you are using to run cucumber
  7. Have you built the -cal target from XCode?
  8. Are you using Xcode5? Have you run sudo xcode-select -switch PATH_TO_XCODE/Content/Developer.When using the final version of Xcode5 you should havexcode-select -print-path
    /Applications/Xcode.app/Contents/Developer➜ ~ instruments
    instruments, version 5.0 (51166)Xcode5 must be installed in the default /Applications/Xcode.app location
  9. Please stop the simulator. Do not start it from Xcode, instead let Calabash launch the simulator.
  10. Make sure you use the iPhone Retina or the iPad simulator. There is a well-known bug with instruments and its ability to launch the iPhone (non-retina simulator).
  11. Try the following – it is the easiest way to test if it is working:In your project folder (typically the folder just above your ‘features’ folder), run:
    DEBUG=1 calabash-ios console
    start_test_server_in_background(:timeout => 30)
    
    

    run_loop.out

    What is the contents of this file? run

    cat /var/folders/…/run_loop.out

     

  12. The password prompt seems to be bogus, as hit cancel still allows calabash to do what it needs to do, and everything works.To resolve the issue, I edited /etc/authorization:
    
               <string>user</string>
    
               <string>rule</string>
               <key>rule</key>
               <array>
                   <string>is-developer</string>
               </array>
    

    This changes system.privilege.taskport, which was using the implicit user rule to ensure the current user was a member of _developer to an explicit rule to do the same. The end security constraints should be identical, and now a password prompt is never shown for calabash. SSH runs work just fine.

    security authorizationdb write system.privilege.taskport is-developer
    
    

     

  13. Try use this command to debug the session and discover what is happening:
    DEBUG=1 calabash-ios console
  14. Start the installation again:
    1. Comment out the APP_BUNDLE_PATH definition on YourProject/features/support/01_launch.rb like #APP_BUNDLE_PATH = "~/..../../myApp-cal.app" so The calabash gem can locate the app automatically.
    2. Open a console go to the project folder from it. Then enter gem install calabash-cucumber this will install the calabash gem its ok to run again even if you installed it previously there’s no harm.
    3. Now open the project file in xcode editor (You can see the calabash.framework added to your project’s framework group successfully.) select the yourApp-cal target and the simulator you want clean, build and run the your App-cal target on your simulator.
    4. Then stop it and come back to that console enter calabash-ios console console will start a ruby console that you can work with the app. now (while simulator is on your screen but your app is backbround on that simulator) type start_test_server_in_background your app must come to foreground. If that works the calabash can find and run your app on simulator.
    5. Remember only if you create an app build on a separate folder using a xcodebuild command or script or something, thats the time to set the APP_BUNDLE_PATH variable.
  15. Look what is the result of these commands:
    # xcode installation location
    $ xcode-select --print-path
    # xcode version
    $ xcodebuild -version
    # calabash version
    $ calabash-ios version
    # calabash.framework version
    # start your app manually in the simulator or from Xcode
    # and then launch a console
    $ calabash-ios console
     server_version
  16. Look if it is enable, running this command:
    DevToolsSecurity -status
  17. Try these steps:
    1. Update gem packages: sudo gem update
    2. Cleanup old gem packages: sudo gem cleanup
    3. Execute “Clean build folder…” in Xcode
    4. Close Xcode and simulator
    5. Delete all folders from /Developer/Xcode/DerivedData
    6. Reboot your computer
    7. Rebuild your project and run the tests
  18. Try reset Simulators:

    killall 'iPhone Simulator'
    rm -rf ~/Library/Application\ Support/iPhone\ Simulator/
  19. You can turn on additional calabash debugging running:
    DEBUG=1 CALABASH_FULL_CONSOLE_OUTPUT=1 calabash-ios console
  20. Connect to calabash-ios console and use query when executing command:
    DEVICE=ipad DEVICE_ENDPOINT=http://xx.xx.xxx.xx:37265 BUNDLE_ID=build/LPSimpleExample-cal DEVICE_TARGET=device calabash-ios console
  21. Follow these steps:
    1. Reboot the device
    2. Make sure you can see the device from XCode “devices” (Cmd-2) and that it is “green”
    3. Make sure the app is installed on the device
    4. Make sure you can run “profile” with automation from xcode
    5. Make sure the device doesn’t have a “autolock passlock code”
    6. Reboot your mac.
  22. Use OS key for OS version, name key for device, key-value options list should be comma separated.
    For example:
    xcodebuild -project ABC.xcodeproj -scheme ABC-cal -destination OS=6.1,name=iPad
  23. Clear the instruments:
    1. Run this command:
      killall -9 instruments
    2. And restart the device sometimes works.
  24. After trying all these things, restart your pc and try again:
    $ SDK_VERSION=6.0 DEVICE_TARGET=simulator DEVICE=iphone cucumber

    (This is the last hope… lol)

Thank you again !

Fonts:

https://groups.google.com/forum/#!msg/calabash-ios/AXrXhGB2_mc/wIzR16Sm2IEJ

https://github.com/calabash/calabash-ios/issues/203

https://github.com/calabash/calabash-ios#important-notice

http://www.gerardcondon.com/blog/2012/10/22/setting-up-calabash-on-ios/

https://groups.google.com/forum/#!topic/calabash-ios/b1f1sVtU0ys

https://github.com/calabash/calabash-ios/wiki/A0-UIAutomation—instruments-problems

https://github.com/calabash/calabash-ios/wiki/01-Getting-started-guide

https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html

http://stackoverflow.com/questions/24022823/ios-simulator-doesnt-launch-with-calabash

https://groups.google.com/forum/#!msg/calabash-ios/B3OUOYf7lFY/u8uBYGCOyosJ

https://groups.google.com/forum/#!topic/calabash-ios/ntpNi91DeCE

https://groups.google.com/forum/#!msg/calabash-ios/jfx9CvVoliw/EARXTGYdaFkJ

http://www.marshut.com/uvuzr/calabash-tests-do-not-start-on-iphone-devise-though-application-has-been-started.html

http://www.marshut.com/vutwq/for-people-with-launch-and-ios7-questions.html#imqxmw

http://www.marshut.com/mxzin/instrument-errors-when-trying-to-execute-test-cases-in-device-calabash-9-144.html

 

 

 

2 thoughts on “My app doesn’t start when I run the command cucumber

  1. This was really helpful, thanks. My own problem was that my xcode-select was targeting Xcode 6.3 ß 2. I had to point it back to a non-beta version.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.