Timeout not effective - Set abort time limit for test case

Ranorex Studio, Spy, Recorder, and Driver.
TestBalloon
Posts: 15
Joined: Thu Mar 03, 2022 9:19 am

Timeout not effective - Set abort time limit for test case

Post by TestBalloon » Tue Sep 20, 2022 8:50 am

Hello,

We have an issue with the test cases once the (desktop) application under test freezes. When that happens, Ranorex seems to ignore all timeouts set on repository objects and actions and does not fail the current test case (so that the next test case can start). Instead, the current test case continues to run indefinitely.
We had a test case running for 5+ hours now multiple times. It only occurs when the AUT freezes. Is there a way to set a limit for the test case time?
The only idea I have i to terminate the script externally, but we would terminate the whole test suite, which is not what we want. I only want to terminate the current test case and fail it after X minutes have passed.
I found another thread on this but it is unanswered https://www.ranorex.info/global-test-ca ... t6260.html

Thank you.

dhale
Posts: 84
Joined: Thu Feb 27, 2014 7:33 pm

Re: Timeout not effective - Set abort time limit for test case

Post by dhale » Fri Sep 23, 2022 7:03 pm

Aw unhelpful as it sounds, I would say that since the issue is "It only occurs when the AUT freezes" - that time and effort should be spent by you and your developers figuring out what specifically causes the AUT to freeze.

Your developers can help by adding additional AUT logging.
You can help by adding additional test suite logging, and possibly capturing screen recordings to help "show" the developers what's going on leading up to the "freeze".

I've had the exact same issues as you - and in the end it was ALWAYS on our developers to fix the CORE cause of the application freezing/hanging.

QATest879
Posts: 32
Joined: Fri Jul 02, 2021 2:35 pm

Re: Timeout not effective - Set abort time limit for test case

Post by QATest879 » Tue Sep 27, 2022 8:21 pm

I know the solution but it depends on the context.

Here is how to do it in C# (I assume you are coding?) If not, then that's fine too but I'd need to know more about how you are executing the testcases.

Assume I make a master recording that runs all my other recordings, I'll call it recording1. And my actual test is called Recording2.

Recording2 is just "Delay.Duration(30000);" it does nothing but wait for 30 seconds (30000ms) and then close.

But let's say 30 seconds is too long for me, and I want to cancel the recording if it takes more than 10 seconds and immediately move on to the next recording, this is how you do it:

First, I must call recording2 from Recording1 like this:

try {
Task task = Task.Factory.StartNew(() => Recording2.Start());
task.Wait(10000);
if (!task.IsCompleted){
Report.Log(ReportLevel.Warn,"The recoridng went over the time limit!");
}
return task.IsCompleted;
}
finally {
}

(This is the code in recording 1, it requires "using System.Threading.Tasks;" at the top where all the usings are.

Now, my main program that's running is no longer Recording2, so it's not taking up all my availability, now I am simply running recording2 through recording1.

If the task didn't complete within the 10000ms (10 seconds) then it returns, meaning it cancels the program, and I do not wait for the 30 second program to end, I end it manually after 10 seconds by returning. I am attaching a picture of what it looks like when I run my code now: Even though the recording wanted to run for 30 seconds normally, it gets terminated after only 10 seconds now (it's 15.432 because of extra time).

Since you are trying to limit an entire testcase, you can probably run all the recordings manually inside of a method using recording.start() and then just use that method in place of recording2 in my example. Sorry if you don't code or if this is hard to understand I can explain more if you have questions or issues. That's my best solution!
15 seconds.png
You do not have the required permissions to view the files attached to this post.