Hi,
I have a test case (add users) with data from an excel sheet. I want to be able to break out of the iteration if certain data in that iteration doesn't meet the criteria, say duplicated email address
action1
action2
.
.
action5
action6 is user code validation method in *.usercode.cs, if duplicate email error message UI element presents here, stop doing action7 to action 10 and start the next iteration. if not, continue with action 7 to 10 ( add this user to database)
.
.
action9
action10
How to achieve this in Ranorex?
Thanks,
skip iteration(s) for a data drive test case
Re: skip iteration(s) for a data drive test case
Hi,
These action1...action10 are the actions in Recordings, right? So basically, you want to skip the remaining recording module steps if the one with UserCode fails? I believe the only way to achieve this is to convert the "remaining" steps to user code and use them as a part of the validation UserCode action. So if the validation fails, you can skip the remaining steps (using a condition in your validation code).
Here is a pseudo code explaining how your validation method should look like:
There is currently no way to perform conditional operations directly in recording module.
These action1...action10 are the actions in Recordings, right? So basically, you want to skip the remaining recording module steps if the one with UserCode fails? I believe the only way to achieve this is to convert the "remaining" steps to user code and use them as a part of the validation UserCode action. So if the validation fails, you can skip the remaining steps (using a condition in your validation code).
Here is a pseudo code explaining how your validation method should look like:
Code: Select all
try
{
Validate.Attribute(repo.something.ViewInfo, "Text", "yourValue");
}
catch (Ranorex.ValidationException)
{
return;
}
action7
...
action10
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: skip iteration(s) for a data drive test case
Hi odklizec,
Yes actions1 ... action10 are actions in Recordings.
That was I thought too since there is no direct conditional actions in recording module.
However when I try it approach
try {
//do validate
}
catch {
//do some cleanup actions
return; // return just simply terminate all the iteration including the current one, it won't go to the next //iteration
}
Yes actions1 ... action10 are actions in Recordings.
That was I thought too since there is no direct conditional actions in recording module.
However when I try it approach
try {
//do validate
}
catch {
//do some cleanup actions
return; // return just simply terminate all the iteration including the current one, it won't go to the next //iteration
}
Re: skip iteration(s) for a data drive test case
Hi,
Make sure the test case (in which is placed your recording) has set the error behavior to "continue with iteration". Check this link for more details about error behaviors...
http://www.ranorex.com/support/user-gui ... html#c3028
Make sure the test case (in which is placed your recording) has set the error behavior to "continue with iteration". Check this link for more details about error behaviors...
http://www.ranorex.com/support/user-gui ... html#c3028
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: skip iteration(s) for a data drive test case
Got it. The support guy from Ranorex pointed that out too. It works now.
Thanks so much.
Thanks so much.
Re: skip iteration(s) for a data drive test case
You are welcome
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration