Search code examples
iosjsonxcodecalabash

Calabash-ios: Run test physical device installed ipa without xcodeproj


I am new with calabash-ios and have a dummy question is:

How possibly could I run a calabash test with real device which have installed ipa file (included calabash framework) and without xcodeproj?

Problem is I am doing QA and Dev only gives me ipa file to test without source code.

UPDATE: I am able to run the ipa file in console and cucumber by adding BUNDLE_ID. And make sure the CFNetwork.framework is including in app framework to establish the connection.

But I got another problem to run the scenario: 1. When I run the command below:

DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID cucumber

Then I got this error:

 A JSON text must at least contain two octets! (JSON::ParserError)
  features/my_first.feature:8:in `Then I touch "LOG-IN/ CREATE ACCOUNT"'

all other steps was skipped

  1. Then I run the console code

    DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID calabash-ios console
    

Then I run server_version I got reply back that said connection SUCCEED But when I run start_test_server_in_background It took me too long to wait and I see the app my physical device kept crashed and launch again and again until it stop as:

Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Calabash::Cucumber::Launcher::StartError: 

"Timed out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
 2015-10-01 10:49:41.634 instruments[15640:10558880] WebKit Threading Violation - initial use of WebKit from a secondary thread.
 2015-10-01 10:49:42.574 instruments[15640:10558978] Attempting to change event horizon while disengage
 2015-10-01 10:49:42.577 instruments[15640:10558877] Attempting to change event horizon while disengage
 Instruments Trace Error : Target failed to run: Permission to debug app

Anyone can help please! I tried to search some solution but they almost issue on simulator and they contain xcodeproj. As a QA, I dont have the source code, only .ipa file. :( Thanks


Solution

  • You should set 3 variables:

    $ DEVICE_TARGET=<UDID> \
        DEVICE_ENDPOINT=http://<ip>:37265 \
        BUNDLE_ID=com.example.YourApp cucumber
    

    The device and the host computer should be on the same network.

    The .ipa must be installed on your device.

    You can do this in Xcode by dragging-and-dropping in the Device Manager window or with a third-party tool like ideviceinstaller (available with homebrew).

    You should never set NO_LAUNCH.

    http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-NO_LAUNCH

    You also need to enable you device for develop and turn on UIAutomation in the Settings.app > Developer.

    1. Enabling device for development
    2. RunLoop::Fifo::NoReaderConfiguredError

    UPDATE In response to this question, I rewrote the Testing on Physical Devices Calabash iOS wiki page. Wow, that content was ancient!