ios - GHUnit - 终端 - "BAD CPU type in executable"

标签 ios unit-testing xcode5

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

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

使用 Xcode5、iOS7 和 Wifi 网络

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

最佳答案

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

来 self 的 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;
}

已编辑:我成功地从命令行在设备上运行,步骤如下:


来 self 的 blog

  1. 使用工具 ideviceinstaller安装到您的设备中

    ideviceinstaller -i <your app>.ipa

  2. 获取设备中的应用程序文件夹(以保留 xml 文件)

    app_path= ideviceinstaller -l -o xml | grep <your app>.app | sed 's/.*<string>\(.*\)<your app>.app<\/string>/\1/'

  3. 将测试应用程序运行到设备中(不要保存在 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

  4. 从设备获取存档应用程序(以提取 xml 文件)- 测试应用程序完成运行后

    ideviceinstaller -a com.<org>.<your scheme> -o copy=. -o remove

  5. mv com.<org>.<your app>.ipa <any app name>.zip

  6. unzip -o <any app name>.zip

  7. cp Container/Library/Caches/test-results/*.* <your folder to keep the result xml files>

关于ios - GHUnit - 终端 - "BAD CPU type in executable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20263007/

相关文章:

ios - UITableViewCell : Allowing Selective Deletion

ios - iOS 上带页面控件的导航栏

ios - Xcode 不显示build设置选项的菜单

asp.net-mvc - "App_GlobalResources"未在单元测试用例中加载

ios - UI 选项卡栏 Controller 不显示设备上的所有选项卡。模拟器完美运行

macos - 如何在本地测试提交的使用 iCloud 的 Mac App?用开发文件重新签名?

ios - Swift 中的自定义委托(delegate)方法

iphone - 如何执行转场

c# - 应该在没有 TestMethod 属性的方法中使用 Assert 吗?

javascript - JS 单元测试无需将整个 HTML 复制到单元测试中?