开发者

Problem with GHUnit + Hudson/Jenkins in Xcode 4

I've followed this very good tutorial on how to configure GHUnit in Xcode 4 and integrate it with Hudson/Jenkins.

Everything seems to work fine when all test cases pass, but when a test case fails, the Hudson/Jenkins doesn't create the "test results" where you can actually check details about the test cases that failed.

Checking the console output I see this:

Test Suite 'Tests' finished.
Executed 2 of 2 tests, with 1 failures in 开发者_如何学编程0.024 seconds (0 disabled).

Failed tests:
    ExampleTest/testFoo

Wrote JUnit XML successfully.
Command /bin/sh failed with exit code 1


** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution "Run Script" build/FirstUnitTestingProject.build/Debug-iphonesimulator/Tests.build/Script-DA6E61A913A94E9F00DE8C5B.sh
(1 failure)
make: *** [test] Error 65
Recording test results
Finished: FAILURE

The script that is being executed can be found here.

It fails in both, Jenkins and Hudson with the same exception.

Does anyone knows how to fix this?

Thanks.


Vic, by looking at console report everything seems normal. This is how console output will be when a test case fails. I tried the scenario by changing the test case to fail. I was able to get full details of failed test. I am using Hudson. Take a look at the below image:

Problem with GHUnit + Hudson/Jenkins in Xcode 4


If a test fails then the RunTests.sh exits with a non zero status and Xcode considers that the build failed. I encountered the same issue and I found this workaround: replace the last line of RunTests.sh by this one:

#exit $RETVAL
exit 0

Therefore the builds keep on running even if some tests fails.

Moreover if you are using a post-build action to publish the tests results the build is marked as unstable when some tests fails (which is exactly the behaviour I wanted).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜