Fork me on GitHub

Skipping Tests After First Failure

To skip remaining tests after first failure or error has happened set configuration parameter skipAfterFailureCount to 1.

Skipping Tests After the Nth Failure or Error

To skip remaining tests after the Nth failure or error has happened set configuration parameter skipAfterFailureCount to N, where N is number greater than zero.

Prerequisite

Use maven-failsafe-plugin 2.19 or higher, JUnit 4.12 or higher, or TestNG 6.14.3 or higher. Since 3.6.0, all test frameworks run via the unified JUnit Platform provider.

Notices

TestNG reports skipped methods however JUnit reports skipped classes. Preferably use JUnit 4.12 or higher version which fixed thread safety issues.

Limitations

Although this feature works in forking modes as well, the functionality cannot be fully guaranteed (real first failure) in concurrent mode due to race conditions. The parameter reuseForks should be always set to true (which is default value), otherwise this feature won't work properly in most cases.

Other features

Re-run and skip execution

Since of 2.19.1 you can use parameters skipAfterFailureCount and rerunFailingTestsCount together. You can run again failed tests and skip the rest of the test-set if errors or failures reached skipAfterFailureCount. Notice that failed tests within re-run phase are not included in skipAfterFailureCount.