0

I've got the following test:

public class AppITCase

{

    @Test
    public void failTest() {
        fail();
    }
}

It just fails. But if I run mvn clean test-compile failsafe:integration-test, I will see this:

Results :

Failed tests:
  AppITCase.failTest:16

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.853 s
[INFO] Finished at: 2017-01-14T01:32:16+04:00
[INFO] Final Memory: 11M/141M

Important lines:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 
[INFO] BUILD SUCCESS [INFO]

What? Why maven accepted this build, if it had test failures? How to solve this?

UPD If I run mvn verify

[INFO] Scanning for projects...
[INFO]

[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ vsjws-samples ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ vsjws-samples ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.333 s
[INFO] Finished at: 2017-01-14T01:41:23+04:00
[INFO] Final Memory: 15M/200M
[INFO] ------------------------------------------------------------------------
Tony
  • 459
  • 1
  • 5
  • 18
  • Possible duplicate of [maven-failsafe-plugin Failures and BUILD SUCCESS?](http://stackoverflow.com/questions/12279160/maven-failsafe-plugin-failures-and-build-success) – shmosel Jan 13 '17 at 21:34
  • Also of http://stackoverflow.com/questions/14614374/error-during-failsafe-integration-test-does-not-cause-failed-maven-build, the tldr there being that you should do `mvn verify` and not `mvn failsafe:integration-test` – yshavit Jan 13 '17 at 21:35
  • But no. mvn verify didn't even run the test as I can see. Still 'BUILD SUCCESS' – Tony Jan 13 '17 at 21:39
  • `mvn clean verify` The output logs you got are weird, considering the failsafe plugin did not even run... – Tunaki Jan 13 '17 at 23:33

0 Answers0