简体   繁体   中英

Testng pass suit if test failed

We use TestNG for testing and we need to see that test is failed but it shouldn't fail all test suite.

Is it possible mark the test and continue testing the suite if this test is fails?

Based on the info you've provided it's really hard to tell what is your motive behind doing that and I would strongly recommend to avoid messing with suite results since you're making this information misleading BUT, in order to do what you want you may try to implement custom ITestListener , from here you have 2 options:

  1. Override test results by setting status in onTestFailure() method, but it would still show failed tests in suite results, however suite itself will be marked as passed if there are no test failures.
  2. Remove failed tests completely (or based on any condition you want) by cleaning test results using getFailedTests().getAllResults() from ITestContext in onFinish() method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM