Downloading Large Files

I am trying to download a large file that is compiled as part of a database query. This means this file takes a VERY long time to run and return. The issue I am having is the step fails every time after 600 seconds, with no apparent way to change it to match expectations. I have fiddled with every timeout I found (global & project), but it looks like the step timeout is hardcoded.

I also had some lesser concerns around the project timeout being set so high. The problem is by setting it so high, when I run the Test Suite, it applies to all test cases, not just the test case that is known to run long. Is there a test timeout setting somewhere, if not a step timeout?

Can someone suggest how to work around this?

Thread.sleep (600000)

Thank you. I am trying that now!

Unfortunately that didn’t work as I had hoped. Perhaps showing snippets will help:

Test Script snippet where issue occurs:

...
//This navigates to the page needed
WebUI.click(findTestObject('KPI_Patient_Data/a_KPI - Patient Data'))
//This clicks on the button to download the report
WebUI.click(findTestObject('KPI_Patient_Data/input_generate_schedule_report'))
...

I have tried several different options and parameters to try delaying the timeout, including the above Thread.sleep() option both in the click object (it failed since it isn’t supported) as well as immediately after.

My last attempt looked like (comments removed for brevity):

...
WebUI.click(findTestObject('KPI_Patient_Data/a_KPI - Patient Data'))
WebUI.click(findTestObject('KPI_Patient_Data/input_generate_schedule_report'))
Thread.sleep(1800000)
...

Unfortunately the form submit on the click action rarely ever completes (almost never see “End action: click” in the console for this step) to get to the Thread.sleep action. After talking to one of our developers, we are looking at rewriting the button submit action, but I have a difficult time believing this isn’t a common issue. I just haven’t found a way to make it work in Katalon Studio yet.

Hi Thomas

I’ve come across a few tutorial-type videos which say Thread.sleep is rarely a good idea. Not entirely sure why. That said…

If the click event is stalled waiting on a response, this is starting to sound like a bug. How long would it actually take under normal test conditions? I’m wondering if there’s some way to try/catch the error and let it continue, perhaps.

I still think you should report it as a bug. You can’t automate something if the automaton runs out of battery power :wink:

Hello Russ

The download normally takes between 15 and 20 minutes to run the query and download the file. So 600 seconds is way too short to run for the form submit timeout in this case. I am not sure it is exactly a bug, as it works as designed, it is just the design timeout is too short for this use case.

For now, my workaround is to continue on fail, and write another step to manually check the download much later, but even that is subject to issues. Is it because it failed to download, is still in process, or downloaded to another location, just to name a few issues I have had with this workaround, though. I guess every test has it’s known limitations, and maybe this is the limitation for our situation until the developers can change the behavior.

That said, I can file it as a bug report for the developers to respond to and fix, if appropriate. Thank you for your response.

Jeez… 15+mins? Wow.

Well, in that case, might I suggest a different approach? How about polling for a result posted somewhere? In which case, Thread.sleep would probably be fine (but keep this case away from any parallel test suites which is where sleep can cause issues, I hear). As for the polling routine itself, I can’t help there - I’m still too green at Java. But I’m sure it could be written with ease by a suitably skilled Java-jock.

Try posting to Stackoverflow? (And post the thread link here!)