Tests and Failures

View: New views
4 Messages — Rating Filter:   Alert me  

Tests and Failures

by Tennis Smith-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Tests and Failures

by ddevienne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 30, 2009 at 11:17 AM, Tennis Smith<tennis@...> wrote:

> 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?

AFAIK, the link between CC and Ant is via an XML log file, and XSL
stylesheets that massage this XML to generate something else like your
dashboard report. (that's also what <junitreport> does BTW). You must
then change the way the XML is processed to generate your dashboard
report to look for and flag those entries. How you do that depends on
how this info appears in the XML (as elements/attributes, or simply
text). To avoid interfering with the existing transformation to the
reports, you could add a pre-transformation converting your 0/0/0/0.0
entries into actual failures (the way "normal" failures are typically
reported in the XML), doing an XML to XML transform of just those
nodes for your special "empty" tests, and feed this document to the
dashboard/CC. You might also be able to do the same think directly on
the Ant side (maybe by altering XMLLogger?), although I don't know
where to start with this. Without more knowledge of the "pipeline"
used by CC these days, I can't suggest more. --DD

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


Re: Tests and Failures

by David Weintraub :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...

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


Re: Tests and Failures

by Tennis Smith-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great idea! Thanks.
-T

On Wed, Jul 1, 2009 at 8:46 AM, David Weintraub <qazwart@...> wrote:

> 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@...> 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@...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>