locked
How to run a ruby calabash-cucumber test on a real iOS device RRS feed

  • Question

  • User61855 posted

    I am trying to run a calabash test on the iOS Device. I have already done this:

    • I have run the test on the iOS simulator. No problems until it reaches the "take picture" view; where obviously it doesn't work because it's an emulator.

    • I have read and followed these instructions 07 - Testing-on-physical-iDevices

    • I have already enabled UI testing on the device. (Settings->Developers->Enable UI Testing)

    I have run the test using the most complete command:

    BUNDLE_ID=com.mycompany.SimpleApp DEVICE_TARGET=2342342423423234237f239563ea DEVICE_ENDPOINT=http://192.168.2.433:37265 cucumber

    And I get these errors and the test doesn't run:

    Note 1: When I launch the App via Xamarin Studio deploying to the device, the log output doesn't print Calabash Server, but it does when I'm deploying to the emulator.

    Note 2: The previous error is shown without the device showing anything, I think it doesn't even connect to the device.

    Have anyone here got to run a Calabash test on a real device? Do you know any link with better instructions?

    Thank you!

    Tuesday, December 2, 2014 12:31 PM

All replies

  • User61855 posted

    It may have something to do with the default configuration. The 01_launch.rb file contains this, and the error is raised by the first 'Before'

    ########################################
    #                                      #
    #       Important Note                 #
    #                                      #
    #   When running calabash-ios tests at #
    #   www.xamarin.com/test-cloud         #
    #   the  methods invoked by            #
    #   CalabashLauncher are overriden.    #
    #   It will automatically ensure       #
    #   running on device, installing apps #
    #   etc.                               #
    #                                      #
    ########################################
    
    require 'calabash-cucumber/launcher'
    
    
    # APP_BUNDLE_PATH = "~/Library/Developer/Xcode/DerivedData/??/Build/Products/Calabash-iphonesimulator/??.app"
    # You may uncomment the above to overwrite the APP_BUNDLE_PATH
    # However the recommended approach is to let Calabash find the app itself
    # or set the environment variable APP_BUNDLE_PATH
    
    
    Before do |scenario|
      @calabash_launcher = Calabash::Cucumber::Launcher.new
      unless @calabash_launcher.calabash_no_launch?
        @calabash_launcher.relaunch
        @calabash_launcher.calabash_notify(self)
      end
    end
    
    After do |scenario|
      unless @calabash_launcher.calabash_no_stop?
        calabash_exit
        if @calabash_launcher.active?
          @calabash_launcher.stop
        end
      end
    end
    
    at_exit do
      launcher = Calabash::Cucumber::Launcher.new
      if launcher.simulator_target?
        launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
      end
    end
    
    Tuesday, December 2, 2014 1:35 PM
  • User61855 posted

    I found the solution. It's so weird! Found it by following all the suggestions here, the one that finally worked was using the Instruments app, target my device and iphone app and record one session. After that I clicked 'play' and saw how the UI steps were being reproduced. Then, I closed the Instruments app and run the cucumber command again and it worked!

    I guess this means that enabling UI test via the iPhone device is not enough...

    Tuesday, December 2, 2014 2:37 PM