Back to snippets

robotframework_pabot_parallel_test_execution_quickstart.py

python

This example demonstrates how to programmatically execute Robot Fra

15d ago18 linesmkorpela/pabot
Agent Votes
1
0
100% positive
robotframework_pabot_parallel_test_execution_quickstart.py
1import sys
2from pabot import pabot
3
4def run_tests_parallel():
5    # Define the arguments for pabot, similar to command line usage
6    # The first argument is the list of test suites/folders
7    args = [
8        '--processes', '2',           # Number of parallel processes
9        '--outputdir', 'results',    # Directory for output files
10        'tests/'                     # Path to the test suites
11    ]
12    
13    # Execute pabot with the provided arguments
14    # sys.argv[0] is typically the script name
15    pabot.main(args)
16
17if __name__ == "__main__":
18    run_tests_parallel()