I'm providing this in case anyone else wants to do the same thing I'm trying
to accomplish.

OK, I have Surefire and Cobertura running during the same test phase. If
either of them fails, the tests fail. Here's how to do it, in case anyone
cares. The thing is, if your tests fail, you won't see coverage information,
since Surefire is run before cobertura:check occurs.

1. Modify your pom file so that cobertura:clean runs during clean,
cobertura:instrument runs during process-test-classes, and cobertura:check
runs after the tests (setting the phase to "test" worked for me).

2. In the plugin jar, remove the line "<executePhase>test</executePhase>"
from META-INF\maven\plugin.xml.

Make sure you backup your plugin jar before attempting this. Some of our
tests take several minutes to run, so this saved a lot of time.

On Fri, Aug 1, 2008 at 5:30 PM, Blake Martin <[EMAIL PROTECTED]> wrote:

> Even if a test fails during the Cobertura phase, Cobertura won't fail, as
> long as the coverage criteria are met. That's what I'm trying to get around.
> AFAIK, the only thing surefire has that Cobertura doesn't is the ability to
> fail when a test fails.
>
> Cobertura should definitely have a way to fail when a test fails, but I
> can't seem to find it documented anywhere.
>
>
> On Fri, Aug 1, 2008 at 4:55 PM, Stephen Connolly <
> [EMAIL PROTECTED]> wrote:
>
>> we've had tests that pass when run with cobertura and fail without. so I
>> always recommend running twice. additionally we've had tests that pass
>> normally, but fail with cobertura. in both cases the root cause analysis was
>> a bug in our code. run them twice and if either run fails you likely have a
>> bug
>>
>> (the exception is sometimes a cobertura test can validly fail without the
>> root cause being a bug. for example, performance tests, or tests that try to
>> force a particular synchronization scenario)
>>
>> Sent from my iPod
>>
>>
>> On 1 Aug 2008, at 20:23, "Blake Martin" <[EMAIL PROTECTED]> wrote:
>>
>>  Currently, our tests are the longest-running part of our Maven lifecycle
>>> and
>>> we'd like to have Cobertura fail if a test case fails so that Surefire
>>> isn't
>>> needed.
>>>
>>> Is it possible to have Cobertura fail when a test fails? Normally, it
>>> only
>>> fails if one of its conditions aren't met (e.g., line coverage).
>>>
>>> Would there be any ramifications, or is this a sane idea?
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

Reply via email to