iOS GHUnit输出Junitxml格式log(为后续的hudson的整合做基础)

来源:互联网 发布:剑三男脸型数据 编辑:程序博客网 时间:2024/05/29 16:50

利用命令行,输出xml格式的log文件http://

1、复制 RunTests.sh和 RunIPhoneSecurityd.sh 的内容到xcodeproj 同目录下

2、在tests target中 选择Add Build Phase + button,->Add Run Script.



3、填写脚本:sh RunTests.sh




4、在终端下运行

iOS app:

GHUNIT_CLI=1 xcodebuild -target Test -configuration Debug -sdk iphonesimulator5.1 build

mac app:

GHUNIT_CLI=1 xcodebuild -target Test -configuration Debug -sdk macosx build


如果出现类似: Couldn't register Tests with the bootstrap server.这样的错误,一般是因为

你的模拟器正在运行中,先将其关闭。


如果要生成:junitxml文件

GHUNIT_CLI=1 WRITE_JUNIT_XML=1(or YES) xcodebuild -project Tests.xcodeproj -sdk 

iphonesimulator4.3-target Tests

如果要指定路径输出路径:

通过JUNIT_XML_DIR可以指定xml输出的路径

GHUNIT_CLI=1 WRITE_JUNIT_XML=YES JUNIT_XML_DIR='/Users/xxx/workspace' xcodebuild 

-projectMarquette.xcodeproj -sdk iphonesimulator5.1 -target MarquetteTest

个人感觉AUTORUN和EXIT是配对使用的,在iphone中感觉AUTORUN没有起作用,不知道怎么回事

GHUNIT_AUTORUN=1 GHUNIT_EXIT WRITE_JUNIT_XML=YES JUNIT_XML_DIR='/Users/xxx/workspace' xcodebuild 

-projectMarquette.xcodeproj -sdk iphonesimulator5.1 -target MarquetteTest


Make

编写Makefile文件 ,在这里我将Makefile放在了和.xcodeproj 同目录下,然后在命令行执行make,make clean,make test可以进行测试,注意在编写

make文件的时候命令的前面是以tab开头的,不然在执行命令时会报错。



 

原创粉丝点击