Maven Cobertura: unit test failed but build success
Posted
by
Pavel Drobushevich
on Stack Overflow
See other posts from Stack Overflow
or by Pavel Drobushevich
Published on 2011-02-28T12:54:00Z
Indexed on
2011/02/28
15:25 UTC
Read the original article
Hit count: 269
Hi all,
I've configured cobertura code coverage in my pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
<configuration>
<instrumentation>
<excludes>
<exclude>**/*Exception.class</exclude>
</excludes>
</instrumentation>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
</plugin>
And start test by following command:
mvn clean cobertura:cobertura
But if one of unit test fail Cobertura only log this information and doesn't mark build fail.
Tests run: 287, Failures: 1, Errors: 1, Skipped: 0
Flushing results...
Flushing results done
Cobertura: Loaded information on 139 classes.
Cobertura: Saved information on 139 classes.
[ERROR] There are test failures.
.................................
[INFO] BUILD SUCCESS
How to configure Cobertura marks build failed in one of unit test fail?
Thanks in advance.
© Stack Overflow or respective owner