Command-Line Testing Using Cocoa Touch

时间:2015-06-15 14:48:33

标签: xcode cocoa kif

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 个答案:

答案 0 :(得分:0)

在检查了几个选项后,我决定使用xctool,因为在使用KIF完成测试时,这是推荐的工具。一开始我在尝试运行测试时遇到了一些麻烦,但在阅读其他帖子后,我使用了以下命令:

运行所有测试:

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

用于在类中运行所有测试:

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

用于在班级中运行特定测试:

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

所有以前的命令都正常工作,这就是我想要做的。