'How to execute multiple files in Robot Framework and save the results

I have a Tests folder which contains multiple folders as shown and inside each of the folders, there are robot files. I want to know if it is possible to run through multiple folders and execute the robot files and save the Results in a specific separate folder.

I have tried out this command: "robot -d C:\Users\Desktop\Results -t {testcase_name} .C:\Users\Desktop\Tests\*\*.robot" But I get different errors like File or directory does not exist.

each folder contains robot file



Solution 1:[1]

This might be a long (because I have no idea what specific format you want) shot but you can use subprocess in python to run each file at the same time. And this works for any program.

run.py

import subprocess

subprocess.run("robot {filelocation}.robot" & "robot {anotherfilelocation}.robot", shell=True)

You do not need to import the subprocess it already comes with python. you can add as many as you want by adding & between the "" commands. In addition "shell = True" will display any console things you did on your program.

Note: This has to be in a separate file then the others

Solution 2:[2]

You would only need to give the directory path, assuming I've understood correctly e.g.

robot -d C:\Users\Desktop\Results C:\Users\Desktop\Tests\

https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#starting-test-execution

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BlueFire02
Solution 2 Matthew King