Our requirement is to move test execution reports to some other file system once they are ready. We were using listener V3 ‘close’ function to move the reports when we are executing them in sequential mode. However, the same would not work when we use Pabot for parallel execution since the reports are not ready by time close function complete its execution. I have tried with the keyword ‘Run Teardown only once’ which did not work. Do we have any keyword or function that waits until reports are fully generated so that I could use and wait for them to be generated? Could someone assist on this? Thanks
Hello!
To handle parallel execution with Pabot and ensure test execution reports are moved only when fully generated, you can use the Run On Last Process keyword. This keyword waits until all other parallel processes have stopped executing before running the specified keyword. Here’s how you can use it:
robot
*** Test Cases ***
Move Reports
Run On Last Process Move Execution Reports
In this example, Move Execution Reports will only be executed once all parallel processes have completed, ensuring that the reports are fully generated before moving them.
As far as I know, Pabot combines all the partial reports (using Rebot) after all the Robot processes finish. I don’t know if you can get Pabot to pass on instructions to its Rebot merge call…
If it is any help, we used a script to run Pabot, which would then use Rebot (again) to do some post-processing on the final results (adding meta-data, shrinking Selenium debug logs, etc) Then if it was running in Azure, Azure took care of moving and packaging the test results.
P.S. I think the preferred approach now is to use a Python “script” to manage running Pabot, Rebot, etc. but it is the same idea.
Hi,
A solution could be to implement a kind of function to verify if the report is ready.
-
If report means “xml”, you can use Parse XML keyword from XML library and verify if parsing can be done or not, and retry with arguments (sleep and retry count).
Here’s a py example, but you can do it in robot:import xml.etree.ElementTree as ET import time def wait_xml_ready(file_path, timeout=30, interval=2): start_time = time.time() while time.time() - start_time < timeout: try: ET.parse(file_path) # try to parse xml return True except ET.ParseError: time.sleep(interval) return False
-
If you need to wait for .html files also, there you could use Get File Size or Get Modified Time and iterate until value doesn’t change with a tolerance.
Regards.
Charlie