tags:

views:

25

answers:

2

I would like to run a JUnit regression Test Suite from within an ANT build script. The test suite has a known number of failures which we are working towards fixing. I want the build to fail if the number of failing tests increases (or changes at all if that's easier to code) - this value can be hard coded in the ANT script.

I'm looking for details on how to implement this.

A: 

The junit task creates and XML file with the failing tests. There's no reason you couldn't use XMLTask to count the number of failures and have a conditional fail if that value is too high.

Jeanne Boyarsky
thanks I will take a look
Tarski
+1  A: 

Even though I'm a bit late to the party:

Another option would be to use JUnit 4 and annotate the failing tests with @Ignore.

That way they will not run, and not count as failures, but the number of ignored tests will still be printed, reminding you there is work left to do.

If a test fails for the first time, you'll get a regular failure; then you can decide whether to fix or to ignore it.

More information:

http://www.devx.com/Java/Article/31983/1954

sleske
Thanks for your response. I hadn't encountered that annotation. Unfortunately, because I am using parametrized tests, I only want to ignore certain tests for certain parameters - I don't think JUnit is flexible enough to do this.
Tarski
Yes, apparently you cannot "@Ignore" just some parameters. You could comment out the failing values, and create a placeholder test that is "@Ignored", so you remember the failing values. That way you don't need to count tests...
sleske