Problem with GHUnit + Hudson / Jenkins in Xcode 4

I 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 the test cases pass, but when the test case fails, Hudson / Jenkins does not create โ€œtest resultsโ€ where you can really check the details of failed test cases.

Checking the console output, I see the following:

  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 executable script can be found here .

In both cases, this is not so, Jenkins and Hudson with the same exception.

Does anyone know how to fix this?

Thanks.

+4
source share
2 answers

Vic, looking at the console report, everything looks fine. This is how console output will be output when the test case fails. I tried the script, changing the test script to fail. I managed to get complete information about the failed test. I use hudson. Take a look at the image below: enter image description here

0
source

If the test fails, then RunTests.sh exits with a non-zero status, and Xcode considers the build to fail. I ran into the same problem and I found this workaround: replace the last line of RunTests.sh with this:

 #exit $RETVAL exit 0 

Therefore, builds continue to work, even if some tests fail.

Also, if you use post-build action to publish test results, the build is flagged as unstable when some tests fail (this is exactly what I wanted).

0
source

All Articles