Line not marked unstable when unit test fails

I added a new job on my hudson server that builds the project using a makefile.

Run shell command:

#!/bin/bash
cd $JOB_NAME
make

      

My makefile looks like

SDK_31 = iphonesimulator3.1
TARGET_DEV = myProject
TARGET_TEST = unitTest

all: debug
debug:
        xcodebuild -sdk ${SDK_31} -target "${TARGET_DEV}" -configuration Debug
        xcodebuild -sdk ${SDK_31} -target "${TARGET_TEST}" -configuration Debug

clean:
        xcodebuild -alltargets clean
        rm -rf build

      

But when hudson builds projects, some unit tests fail, but the build is marked as successful.

What do I need to do to have a "volatile project"?

Respectfully,

+2


source to share


2 answers


You must configure Hudson to capture unit test results by including the "Publish Junit Test Results Report" action in the post-build.

post-build actions http://img141.imageshack.us/img141/5136/hudsonjunit.png




Update. If you cannot get JUnit XML output, you can use the text lookup plugin to change the assembly status:

This plugin allows you to search for keywords in the files you specify and use them to indicate a build as a success or failure.

+2


source


I found this handy ruby ​​script by Christian Hedin that converts the output of OCUnit tests (the format used by Xcode) to JUnit xml files (the format used by Hudson).

You can grab the script at github: http://github.com/ciryon/OCUnit2JUnit

and for an explanation of how to use it, here is his blog post about it: http://blog.jayway.com/2010/01/31/continuos-integration-for-xcode-projects/

Basically, you are passing xcodebuild to ocunit2junit.rb with the following command:



/ usr / bin / xcodebuild -target UnitTests | /usr/local/bin/ocunit2junit.rb

and it puts the xml files in the test reports folder it creates in the root of your project folder. Then tell Hudson to copy the artifacts test-reports/*.xml

as JUnit results and you're set.

This setting will allow Hudson to correctly identify if the unit test passed or failed and correctly mark the build stability.

I've been using it for a month now and it works great. The setup was very simple.

+1


source







All Articles