Skip to content

Commit

Permalink
Add parameters for parallel execution of classes and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
YongGoose committed Jan 12, 2025
1 parent 28a261e commit 0cd9f4d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ public final class Constants {
@API(status = EXPERIMENTAL, since = "5.12")
public static final String PARALLEL_POOL_SIZE = "junit.vintage.execution.parallel.pool-size";

/**
* Indicates whether parallel execution is enabled for test classes in the JUnit Vintage engine.
*
* <p>Set this property to {@code true} to enable parallel execution of test classes.
* Defaults to {@code false}.
*
* @since 5.13
*/
@API(status = EXPERIMENTAL, since = "5.13")
public static final String PARALLEL_CLASS_EXECUTION = "junit.vintage.execution.parallel.classes";

/**
* Indicates whether parallel execution is enabled for test methods in the JUnit Vintage engine.
*
* <p>Set this property to {@code true} to enable parallel execution of test methods.
* Defaults to {@code false}.
*
* @since 5.13
*/
@API(status = EXPERIMENTAL, since = "5.13")
public static final String PARALLEL_METHOD_EXECUTION = "junit.vintage.execution.parallel.methods";

private Constants() {
/* no-op */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ private boolean getParallelExecutionEnabled(ExecutionRequest request) {
return request.getConfigurationParameters().getBoolean(PARALLEL_EXECUTION_ENABLED).orElse(false);
}

private boolean getParallelClassExecutionEnabled(ExecutionRequest request) {
return request.getConfigurationParameters().getBoolean(Constants.PARALLEL_CLASS_EXECUTION).orElse(false);
}

private boolean getParallelMethodExecutionEnabled(ExecutionRequest request) {
return request.getConfigurationParameters().getBoolean(Constants.PARALLEL_METHOD_EXECUTION).orElse(false);
}

private int getThreadPoolSize(ExecutionRequest request) {
Optional<String> poolSize = request.getConfigurationParameters().get(PARALLEL_POOL_SIZE);
if (poolSize.isPresent()) {
Expand Down

0 comments on commit 0cd9f4d

Please sign in to comment.