Online Training: Web test automation with CodeceptJS. Sign up now!

How to use Soft assertion

I would like to use soft assertion in CodeceptJS as like in TestNG. Because currently I am using I.dontSeeInTitle(“Page missing”) and I.dontSee("") Whenever my page encounters issue my execution stopped in the middle, but I need to continue my execution until the end even though it encounters the assertion but it should record the report.

@ShyamN CodeceptJS currently does not support soft assertions, sorry.

well, you can try I.grabNumberOfVisibleElements to see if element is there. That won’t stop the tests.

Thanks for your reply @paulb and @peterngtr. let me try to verify the assertion through conditional statements, I need to try how to write the customized message with snapshots in allure report

@ShyamN keep us updated :slight_smile:

Hi @ShyamN, You can try using chai assertion library and assert the values. By that way you can catch the assertion error and implement your soft assert codes that you have to attach to your report.