End Test Early With Validation Step

Hi there,

Is it possible to end a test early if a validation passes? i.e. I do a check to see if a specific element is present, and if it is then the test should end without failing.

Thanks
David

Hi, yes indeed. Here too you can group the steps after the check into a sub test. Then provide the condition for the sub test to execute ie only if the element is not present

In such cases, I think(anyone feel free to correct me if I am wrong) for checking the presence of the element, it would be good to use " Count elements" add on. Here you can provide the locator as well and it will return the number of elements found. If its greater than 0, you can confirm that the element is present and use it as a condition on your subtest :wink:

2 Likes