You MIGHT be able to do this in Ant...
The JUnit test results are stored in a particular directory when you
do your builds. You should be able to search for the regular
expression:
testsuite errors="0".* tests="0".* time="0"
And, if you find it, fail the buid via the <fail> task. Then
CruiseControl will pick up the build as a failure.
Here's a test I did:
<concat destfile="combined.test.results">
<fileset dir="junit-tests"/>
<filterchain>
<lineContainsRegExp>
<regexp pattern='testsuite
errors="0".* tests="0".* time="0"'/>
</lineContainsRegExp>
</filterchain>
</concat>
<fail message="JUnit Test Results are bogus">
<condition>
<length file="combined.test.results"
when="greater" length="0"/>
</condition>
</fail>
<echo>DEBUG: Everything is peachy!</echo>
The <concat> combined all the test results into a single file. I tried
doing a loadresource, but it wouldn't take a fileset if there was more
than a single file in that file set.
Anyway, the <concat> concatenates all the test results into a single
file. I use the <filterchain> to filter out all the lines that contain
the regular expression that shows zero errors, tests, and time taken.
Once I've done that, I use the fail to fail the build, but I only fail
on the condition that the combined test results file is not empty. If
all the tests are valid, the file will be empty. If someone has a
bogus test, the file will not be empty.
On Tue, Jun 30, 2009 at 12:17 PM, Tennis Smith<[email protected]> wrote:
> Hi,
>
> This is about ant used with cruisecontrol, but I thought someone here may
> know the answer. Nobody seems to know on the cc mailer.
>
> I have a few tests that will be shown as "Tests: 0, Failures: 0, Errors: 0,
> Duration: 0.0" in the dashboard's test suites report. Generally, this is a
> poorly coded test or one that is commented out in the source. So naturally
> we'd like to know when that happens.
>
> How can I make ant/CC determine this is a failing test and report it that
> way?
>
> THanks,
> -T
>
--
David Weintraub
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]