Command-Line Testing Using Cocoa Touch

57 views Asked by At

I have developed several test for an application, and I would like to run this application using the command-line. I have read this tutorial; however, I haven't been able to run them. When executing the following command:

xcodebuild test -project MyApplication.xcodeproj -scheme MyApplication -destination 'platform=iOS Simulator,name=iPhone 6'

I am getting the following error:

Testing failed:
    Linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **

I cannot understand this error, so I wonder if I have to try a different approach or what I am doing wrong. I have to add that I am using KIF for testing.

1

There are 1 answers

0
lmiguelvargasf On BEST ANSWER

After checking several options, I have decided to use xctool because this is a recommended tool when the tests have been done using KIF. At the beginning I had some trouble trying to run the test, but after reading other posts I have use the following commands:

For running all tests:

xctool/xctool.sh \
    -workspace Supermaxi.xcworkspace \
    -scheme Supermaxi \
    test  -sdk iphonesimulator

For running all tests in a class:

xctool/xctool.sh \
        -workspace Supermaxi.xcworkspace\
        -scheme Supermaxi \
        test -only FunctionalTests:TestCase000_Registration  -sdk iphonesimulator

For running a specific test in a class:

xctool/xctool.sh \
    -workspace Supermaxi.xcworkspace\
    -scheme Supermaxi \
    test -only FunctionalTests:TestCase000_Registration/test00_WrongEmail  -sdk iphonesimulator

All previous commands worked correctly, and this is what I wanted to do.