We have an Assertion where we can fail the script if certain condition is not met. Is there any way to pass it as well. For example rather than failing it, if some situation occurs i want the script to stop from executing forward and mark it as passed.
In short, is there any reverse of Assert.fail()
CodePudding user response:
When your test returns without an Exception or failed assertion, it will pass.
You can simply return;
and your test should pass.
CodePudding user response:
Ok out of interest i had a look at your question... After a short search i would suggest using the testng "SkipException". I think this could be useful for your usecase. Maybe set a variable when you get your "situation" and have the SkipException in the "before" block of the other testcases so they are skipped.