My team doesn’t utilize Katalon in a traditional QA-testing sense, and more for automating the manipulation of a WebApp. Lately I’ve been given a project where it’s crucial to notify the team when the testCase takes greater than twenty minutes for whatever reason. Sure, I can identify where known loops that don’t terminate at times by comparing time stamps and doing usual error-handling/fileIO, but I was wondering if there was a way to place a hard cap on runtime.
Cheers gents, thanks for reading.
Edit: I know of something that will work, but it’s really disgusting, and it involves encapsulating every few lines in if-statements that compares time stamps. I find when I start doing things like that there’s usually a more elegant way of doing things that I’m not aware of.
I do something semi-related. The only difference would be, I run a pseudo-test repeatedly for a fixed period (with a resolution accuracy of around ~3mins/9 hours). It’s certainly not the prettiest code I’ve ever written – between the shifting goal posts of the requirements and me stopping once the POC was working, I should probably have rewritten it from scratch – but this is the real world, with no time… I’m still running the POC!
So, I won’t be sharing the code, but I will write out a spec for it. Hopefully, this will get you close:
Let’s call your actual test case “the target”.
Write another test case (“the wrapper”) that wraps the target.
The wrapper uses callTestCase() to run the target.
The wrapper monitors the start time and end time and writes out a report accordingly.
Again, my code will loop around 3 and 4, with another time accumulator watching for 9 or 10 hours to have passed by before setting a flag that terminates the outer loop. Not sure you need that bit, though.
You would want to have many jobs to schedule to run automatically. Some of the jobs would run Katalon but you would also have other various types jobs. It would be a good idea for you to use CI servers, which will enable you to control all of them in a single manner.
I didn’t think about using callTestCase(). That’s elegant for certain stretches of my testCase, but I’m also realizing I posed my question incorrectly. I’d also need to end the testCase as well should that time limit be hit.
My guess is, you want to break up your target test into pieces you can call via callTestCase(). You can set time limits on those and abort with a failure if required.
Ah, that’s clever. Since I haven’t seen a way to affect the callTestCase() or anything to add timeout in the Katalon documentation directly, so I suppose this “lives” in Java/Groovy land.
I haven’t attempted to use a transformation before with Katalon, and assuming transformations don’t upset it, this ought to do it, no? Since the .callTestCase() method would upset it should it take too long.