Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Configure Full Parallel Execution in TestNG via Maven (with Dynamic Thread Control)

Running automation test suites sequentially can quickly become a bottleneck in CI/CD pipelines. To optimize execution efficiency, you can enable full parallel execution using TestNG and Maven, allowing you to control thread counts dynamically right from the command line without modifying XML files every time. Here is a step-by-step guide on how to configure your framework for flexible parallel…

Running automation test suites sequentially can quickly become a bottleneck in CI/CD pipelines. TestNG and Maven offer a solution to optimize execution efficiency by enabling full parallel execution with dynamic thread control. This guide explains how to configure your framework for flexible parallel execution using TestNG and Maven, along with a comparison of native TestNG execution versus custom Allocator/Run Manager approaches.

To configure full parallel execution in TestNG via Maven:

1. Update your `testng_regression.xml` file to set your default parallel mode and thread count. You can specify parallel execution at the suite, class, test, or instance level. For example:

```xml

<suite name="Regression" parallel="methods" thread-count="10" />

```

2. Configure the `pom.xml` file for dynamic control using the `maven-surefire-plugin`. Map properties inside the `<configuration>` block:

```xml

<configuration>

<parallel>${parallel}</parallel>

<threadCount>${threadCount}</threadCount>

</configuration>

```

To override these settings at runtime without modifying the codebase, pass parameters dynamically via Maven command-line:

- **Default Run**: `mvn clean test -P runTestNGTests`

- **Dynamic Thread Count**: `mvn clean test -P runTestNGTests -DthreadCount=15`

- **Change Parallel Mode**: `mvn clean test -P runTestNGTests -Dparallel=classes -DthreadCount=15`

When comparing native TestNG execution versus a custom Allocator/Run Manager approach:

- **Custom Allocator (Run Manager)**: This approach uses a custom Excel-based Run Manager alongside the native TestNG execution. It allows for data-driven testing via Excel sheets and multi-sheet test scheduling. However, it requires global property tuning, code changes for structural updates, and may have restricted TestNG parallel modes.

- **Native TestNG**: This approach uses the native TestNG execution with the `maven-surefire-plugin` and the `testng_regression.xml` file. It provides a cleaner footprint, faster execution loops without file-parsing overhead, and straightforward CLI thread scaling.

When deciding which approach to choose:

- Opt for the **Custom Allocator** if your test suite heavily relies on fine-grained Excel-driven iteration control or multi-sheet test scheduling.

- Choose the **Native TestNG** approach if you prefer a cleaner footprint, faster execution loops without file-parsing overhead, and straightforward CLI thread scaling.

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

Put Your Docker Images on a Diet with Alpine Linux (2015)

Archival repost — originally published on my old blog on June 21, 2015, back when Alpine was still a dark-horse pick rather than the default.

  • Alpine Linux used as Docker image base to reduce size
  • Popular Docker base images like Ubuntu and Debian heavy
  • Alpine Linux popularity increased rapidly among Docker users

scripting et réseaux

OK j'avance sur le script, si j'ai bien compris. Bash c'est pour du petit script rapide et Python quand c'est un peu plus complexe (et idéalement on script dans le language où le script va agir.

  • Bash is best for small scripts, while Python handles complex tasks
  • Networking concepts like IP addresses and ports are challenging to visualize
  • Author plans to learn via online courses by January and document progress

85 Container. 1 Entwickler.

85 Container, 24 Datenbanken, 232 Cron-Jobs — und ein Gründer Wenn ich jemandem sage, dass ich alleine arbeite, kommt meistens dieselbe Reaktion: Ungläubiges Staunen, gefolgt von der Frage, wie das…

  • Founder built system with 85 containers, 24 databases, and 232 automated tasks
  • System completed 1,087 tasks with 88% success rate after 14 months
  • Founder emphasizes automating right tasks, using Guard-Regels for clear boundaries

OIDC: Keycloak setup for ALB Gateway API

Introduction In my previous article , I tested using ALB CRDs to offload JWT validation for OIDC-based authentication to the Amazon EKS Kubernetes API.

  • Terraform/OpenTofu stack used for Keycloak setup
  • Client roles and groups defined for token role claim

More from Saturday 22 August →