GHUnit 的问题 + Xcode 4 中的 Hudson/Jenkins
我遵循了这个非常好的教程,了解如何在 Xcode 中配置 GHUnit 4 并将其与 Hudson/Jenkins 集成。
当所有测试用例通过时,一切似乎都工作正常,但是当测试用例失败时,Hudson/Jenkins 不会创建“测试结果”,您可以在其中实际检查有关失败的测试用例的详细信息。
检查控制台输出我看到这个:
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
正在执行的脚本可以找到
Jenkins 和 Hudson 都失败了,但有同样的例外。
有谁知道如何解决这个问题?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
维克,通过查看控制台报告,一切似乎都很正常。这就是测试用例失败时控制台输出的方式。我通过将测试用例更改为失败来尝试该场景。我能够获得失败测试的完整详细信息。我正在使用哈德森。看看下面的图片:
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:
如果测试失败,则 RunTests.sh 将以非零状态退出,并且 Xcode 认为构建失败。我遇到了同样的问题,并找到了解决方法:将 RunTests.sh 的最后一行替换为这一行:
因此,即使某些测试失败,构建也会继续运行。
此外,如果您使用构建后操作来发布测试结果,则当某些测试失败时,构建将被标记为不稳定(这正是我想要的行为)。
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 ofRunTests.sh
by this one: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).