Accelerating test execution in a Hybrid Automation Framework (combining Data-Driven and Keyword-Driven architectures) requires an efficient parallel execution strategy. By dynamically mapping keyword actions and test data rows to concurrent threads, you can drastically reduce execution time without compromising framework design.
Here is a guide on setting up parallel execution using a central Allocator and Run Manager.
1. Overview of the Setup
The framework leverages a Run Manager sheet to map keywords to execution steps and pull test data dynamically.
Parallelization works by assigning NumberOfThreads to match the exact number of active test cases marked for execution.
Key parameters are configured globally inside the Global Settings.properties file.
2. Configuration Steps
a. Set the Number of Threads
Total the number of test scenarios marked with Execute=Yes across your target keyword and data sheets.
Set NumberOfThreads equal to this count.
Example:
If your Run Manager sheet contains 42 test iterations set to Execute=Yes, update your configuration:
NumberOfThreads=42
b. Disable Profile-Based Execution (If Not Needed)
For clean parallel browser execution, set EnableProfile=False.
If user profiles are required to maintain session state across keywords, set UseMultiProfile=True and configure separate profile directories per thread to avoid file-lock conflicts.
c. Prepare the Run Manager
Flag every keyword test case intended for the current run with Execute=Yes.
The allocator will read these rows, pair them with their corresponding data sets, and dispatch them to the thread pool.
3. Executing the Test Suite
Trigger the allocator flow via Maven:
mvn clean test -P runAllocator
The allocator reads the mapped keyword sheets and test data, initializes the specified NumberOfThreads, and executes the tests in parallel.
4. Handling Multiple Keyword & Data Sheets
Option 1: Use a Master Control Sheet (Recommended)
Consolidate execution rows into a single master sheet (e.g., All) that acts as the entry point for all test cases:
Flag all target tests with Execute=Yes.
Update Global Settings.properties:
RunConfiguration=All
NumberOfThreads=38
Thread Allocation Breakdown:
| Suite / Sheet Name | Execute=Yes Rows | NumberOfThreads |
|---|---|---|
| Core_Keywords | 18 | 18 |
| Feature_Data_A | 6 | 6 |
| Feature_Data_B | 6 | 6 |
| Setup_Keywords | 3 | 3 |
| Smoke_Data | 2 | 2 |
| Feature_Data_C | 2 | 2 |
| Master_Suite | 1 | 1 |
| TOTAL | 38 |
Execute using:
mvn clean test -P runAllocator
Option 2: Multi-Sheet Keyword Execution (Advanced)
If your keywords and data sets are spread across individual feature sheets:
Update Allocator.java to handle comma-separated sheet values by modifying the getRunRows() method to parse and merge keyword execution blocks across sheets.
Update Global Settings.properties:
RunConfiguration=Core_Keywords,Feature_Data_A,Feature_Data_B,Feature_Data_C,Setup_Keywords,Smoke_Data
NumberOfThreads=37
- Rebuild the framework project to apply the changes.
5. Best Practices for Hybrid Parallelization
Keyword Thread-Safety: Ensure driver instances and driver utility classes use ThreadLocal so keywords don't cross-wire browser instances during concurrent runs.
Data Isolation: In data-driven tests, assign unique test data sets (e.g., distinct user credentials) to each thread to prevent collision during concurrent execution of identical keywords.
Resource Monitoring: Parallelizing both keyword parsing and browser instantiation is resource-heavy. Start at 50% thread capacity to evaluate machine or grid health before scaling up.
Isolated Reporting: Ensure logs and screenshots are captured into thread-specific directories so step-by-step keyword logs stay attached to the correct test run.