Hello,
I'm wondering what the correct way is to change/alter the Error Behavior inside of a Code Module.
I have 10 Test Cases inside of a Smart Folder and if a certain situation arises, I want to fail out of the Smart Folder, but if it fails a different way, I want to only fail out of the current Test Case.
Basically I want to know the correct way to change the current behavior to either continue with sibling or continue with parent or whatnot, inside a Code Module.
Any help is appreciated.
Thanks!
Dynamic Error Behavior in Code Module
Re: Dynamic Error Behavior in Code Module
Hey,
The following code snippet should help you:
regards, qwertzu
The following code snippet should help you:
Code: Select all
TestCaseNode currentNode=(TestCaseNode)TestSuite.Current.CurrentTestContainer;
currentNode.ErrorBehavior= ErrorBehavior.ContinueParent;
regards, qwertzu
Re: Dynamic Error Behavior in Code Module
To get back to you on this, I have tried the above and it was error free on compile, but while running, the code never gets past the first of the two lines above and I'm getting a, "Error in popup dialog handler.", message in the logs where it stops.qwertzu wrote: ↑Thu Aug 16, 2018 3:06 pmHey,
The following code snippet should help you:
Code: Select all
TestCaseNode currentNode=(TestCaseNode)TestSuite.Current.CurrentTestContainer; currentNode.ErrorBehavior= ErrorBehavior.ContinueParent;
regards, qwertzu
I have no idea why it would get stuck there.
Re: Dynamic Error Behavior in Code Module
Hi,
The code works perfectly fine on my side.
It seems like you somewhere implemented a popup watcher that runs in a second thread which causes the error.
The message does not seem to be related to the code for changing the error behavior.
So, could it be that you have implemented a popup watcher or something similar?
Also, please always post the whole error message, so the community can better help you with your issue.
regards, qwertzu
The code works perfectly fine on my side.
It seems like you somewhere implemented a popup watcher that runs in a second thread which causes the error.
The message does not seem to be related to the code for changing the error behavior.
So, could it be that you have implemented a popup watcher or something similar?
Also, please always post the whole error message, so the community can better help you with your issue.
regards, qwertzu
Re: Dynamic Error Behavior in Code Module
Hi
Agree with qwertzu. It seems you are implemented the 'decision' code directly in the popupwatcher method? But I don't think it can be done this way. As qwertzu mentioned, popupwatcher runs in a separate thread and it cannot interact with the main thread. What you might need to do is to add a decision code module to each test case/smart folder and eventually change the error behavior from the code module, instead of doing it in popup watcher.
Agree with qwertzu. It seems you are implemented the 'decision' code directly in the popupwatcher method? But I don't think it can be done this way. As qwertzu mentioned, popupwatcher runs in a separate thread and it cannot interact with the main thread. What you might need to do is to add a decision code module to each test case/smart folder and eventually change the error behavior from the code module, instead of doing it in popup watcher.
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