Page 1 of 1

What to do when Validation fails

Posted: Tue Dec 22, 2020 5:55 pm
by bollsx
I have a validation action. How do I do something if the validation fails?

Re: What to do when Validation fails

Posted: Wed Dec 23, 2020 12:10 pm
by theraviz
If you want to fail the test case when the validation fails, use Report.Failure("Test Failed");

Re: What to do when Validation fails

Posted: Wed Dec 23, 2020 3:57 pm
by bollsx
Being new to all of this, are you talking about adding a Report action to my recording. How do I fire that action only if the validate fails?

Re: What to do when Validation fails

Posted: Thu Dec 24, 2020 7:23 am
by theraviz
bollsx wrote:
Tue Dec 22, 2020 5:55 pm
I have a validation action. How do I do something if the validation fails?
If you want to make the execution fail when the validation fails then use "Report.Fail" in the usercode.cs

Or if you dont want to make the execution fail but perform some action then use if-else statement in user code.

you can convert any action recodring to user code by right clicking the action in the recording and from the context menu select "Convert to user code". In the user code you can write the condition as your wish.