如果集成测试失败,如何防止构建?

时间:2017-01-13 21:31:12

标签: java maven integration-testing

我有以下测试:

public class AppITCase

{

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

它失败了。但如果我运行mvn clean test-compile failsafe:integration-test,我会看到:

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

重要行:

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

什么?为什么maven接受了这个版本,如果它有测试失败?怎么解决这个问题?

UPD 如果我运行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] ------------------------------------------------------------------------

0 个答案:

没有答案