Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

How to Configure Full Parallel Execution in a Hybrid (Data & Keyword-Driven) Framework

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…

Accelerating test execution in a Hybrid Automation Framework that blends Data-Driven and Keyword-Driven architectures calls for an effective parallel execution approach. By strategically assigning keyword actions and test data rows to concurrent threads, the framework can significantly shrink execution time without sacrificing the overall design. Follow this guide to set up parallel execution using a central Allocator and Run Manager.

The framework employs a Run Manager sheet to map keywords to execution steps and fetch test data dynamically. Parallelization is achieved by assigning the NumberOfThreads parameter equal to the total number of active test cases marked for execution. This count is determined by setting NumberOfThreads in the Global Settings.properties file.

To achieve clean parallel browser execution, disable profile-based execution by setting EnableProfile=False. However, if user profiles are necessary to preserve session state across keywords, enable multi-profile execution by setting UseMultiProfile=True. In this case, configure separate profile directories for each thread to prevent file-lock conflicts.

In your Run Manager sheet, flag every keyword test case that should participate in the current run by setting Execute=Yes. The allocator will read these rows, pair them with their corresponding data sets, and distribute them to the thread pool.

To execute the test suite, trigger the allocator flow by running the command: mvn clean test -P runAllocator. This command instructs the allocator to read the mapped keyword sheets and test data, establish the specified NumberOfThreads, and execute the tests concurrently.

There are two methods for managing multiple keyword and data sheets:

1. Use a single master control sheet: Compile execution rows into a single master sheet (e.g., All) that serves as the entry point for all test cases. Flag all target tests with Execute=Yes. Update the Global Settings.properties file to set RunConfiguration = All NumberOfThreads = [total number of keywords] and specify the thread allocation breakdown.

2. Execute keywords from multiple sheets: If your keywords and data sets are scattered across individual feature sheets, update the Allocator.java file to handle comma-separated sheet values. Modify the getRunRows() method to parse and merge keyword execution blocks across sheets. In Global Settings.properties, list all relevant sheets under RunConfiguration and set NumberOfThreads accordingly.

When configuring parallel execution, it's crucial to follow best practices to ensure optimal performance and stability:

- Keyword Thread-Safety: Utilize ThreadLocal for driver instances and driver utility classes to prevent cross-wiring of browser instances during concurrent runs.

- Data Isolation: Assign distinct test data sets (such as unique user credentials) to each thread to avoid data collisions when executing identical keywords concurrently.

- Resource Monitoring: Parallelizing keyword parsing and browser instantiation is resource-intensive. Begin with a lower thread capacity (e.g., 50%) to gauge machine or grid health before scaling up.

- Isolated Reporting: Capture logs and screenshots into thread-specific directories to maintain clear attachment of step-by-step keyword logs to the correct test run.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

CDN: How Websites Serve Content Faster Globally

Imagine opening a website from India while its servers are located in the United States. You request an image. Your request travels thousands of kilometers to the server, the server processes it, and…

More from Tuesday 18 August →