0

I have a test script which is to be run for "n" number of data, I'm Doing that using @DataProvider, Now my problem is when i use "Assert" to fail the test case when test fails for 1 particular data, then execution of whole Test Script stops. I want it to keep executing even when it fails for 1 data. How can i do it ? can anybody help? thanks !!

Barett
  • 5,826
  • 6
  • 51
  • 55
Nilamber Singh
  • 804
  • 1
  • 14
  • 33
  • 1
    possible duplicate of [How to continue execution when Assertion is failed](http://stackoverflow.com/questions/5402412/how-to-continue-execution-when-assertion-is-failed) – LittlePanda Apr 23 '15 at 10:27

1 Answers1

1

In order to achieve this you'll need to use a soft Assertion which usually records the failure and continue execution although i personally think that when a failure occur test should stop and shouldn't go further however this depends on how independent and simple your tests are.

See links below to help you with Soft Assertions

http://grepcode.com/file/repo1.maven.org/maven2/org.testng/testng/6.8/org/testng/asserts/SoftAssert.java
https://rameshbaskar.wordpress.com/2013/09/11/soft-assertions-using-testng/

Zach
  • 986
  • 7
  • 19