ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Tests and Failures
Date Wed, 01 Jul 2009 15:46:29 GMT
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<tennis@tripit.com> 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
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message