How can I set pass or fail status for my automation test?

Whenever, I run my automation test, it just shows completed, no matter the test is passed or failed. Please help me.

While performing automation testing with Selenium on LambdaTest Selenium Grid, you may face a scenario where a test that you declared as fail in your local instance may turn out to be completed successfully at LambdaTest. Don’t worry though! We understand how imperative it is to flag an automation test as either “pass” or “fail” depending upon your testing requirement with respect to the validation of expected behaviour.

If you wish to mark a test status as fail/pass at LambdaTest then you can do so by executing the below code:

  • To mark test status to fail

driver.executeScript(‘lambda-status=failed’)

  • To mark test status to pass . driver.executeScript(‘lambda-status=passed’)

Hope this helps.