在终端上运行的GHUnit脚本显示“可执行文件中的CPU类型错误”。它通过XCode在设备和模拟器上执行,但在终端上显示CPU错误。

引用:http://gabriel.github.io/gh-unit/docs/appledoc_include/guide_command_line.html
尝试重置设备网络设置

使用Xcode5,iOS7和Wifi网络

还有其他可能通过命令行运行ghunit测试脚本吗?

最佳答案

确保您使用的是模拟器而不是真实的设备,并且有效的拱门还包括i386。

来自我的blog

我找到了一个适用于模拟器的很好的解决方法。
只需更改main.m:

#import <UIKit/UIKit.h>
#import <GHUnitIOS/GHUnitIOSViewController.h>

int main(int argc, char *argv[])
{
    int retVal;
    @autoreleasepool {
        if (getenv("GHUNIT_CLI")) {
            retVal = [GHTestRunner run];
        } else {
            retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIOSAppDelegate");
        }
    }
    return retVal;
}




编辑:我成功地从命令行在设备上运行,这是步骤:



来自我的blog


使用工具ideviceinstaller安装到设备中

ideviceinstaller -i <your app>.ipa
在设备中获取应用程序文件夹(以保留xml文件)

app_path = ideviceinstaller -l -o xml | grep <your app>.app | sed 's/.*<string>\(.*\)<your app>.app<\/string>/\1/'
将测试应用程序运行到设备中(不要保存在tmp文件夹中,存档时tmp文件夹将被删除),并将XML保留在“ Caches”文件夹中。 (使用idevice-app-runnner工具)

idevice-app-runner -s com.<org>.<your scheme> -DGHUNIT_CLI=YES -DGHUNIT_AUTORUN=YES -DGHUNIT_AUTOEXIT=YES -DWRITE_JUNIT_XML=YES -DJUNIT_XML_DIR=$app_path/Library/Caches/test-results
从设备获取存档应用程序(以提取xml文件)-测试应用程序完成运行后

ideviceinstaller -a com.<org>.<your scheme> -o copy=. -o remove
mv com.<org>.<your app>.ipa <any app name>.zip
unzip -o <any app name>.zip
cp Container/Library/Caches/test-results/*.* <your folder to keep the result xml files>

关于ios - GHUnit-终端-“可执行文件中的不良CPU类型”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20263007/

10-14 22:42
查看更多