-1

I'd like to use TestnNG's SoftAssert type of assertion for getting some warnings.

After test, in results are values eg:

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

Can I get the result for failed SoftAssert as Errors or Skipped tests? Of course, I'd like to have Failures for failed HardAsserts (regular Asserts), too. So, after change the report for 1 HardAssert and 1 SoftAssert will have something like this:

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

or

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

2 Answers2

0

After "sleeping with the problem" and JeffC's comment, thanks again :), i found answer for my question. For Surefire plugin I could set configuration parameter skipAfterFailureCount to 1. http://maven.apache.org/surefire/maven-surefire-plugin/examples/skip-after-failure.html for specify tests.

0

You can add assert message to figure out which soft assert is failed like this:

softAssert.asserEquals(actual, expected, "Your customized message")
Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
Rahul Kote
  • 81
  • 4