Skip to main content
Version: 1.0.2

Quick Start

Requirements

  • Java 17+

If you want to run Paramixel through the Maven plugin, you also need:

  • Maven 3.9+

Add dependencies

Add the Paramixel core dependency:

<properties>
<paramixel.version>YOUR_PARAMIXEL_VERSION</paramixel.version>
</properties>

<dependencies>
<dependency>
<groupId>org.paramixel</groupId>
<artifactId>core</artifactId>
<version>${paramixel.version}</version>
</dependency>
</dependencies>

If you want to run Paramixel tests with Maven, also add the Paramixel Maven plugin:

<build>
<plugins>
<plugin>
<groupId>org.paramixel</groupId>
<artifactId>maven-plugin</artifactId>
<version>${paramixel.version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Write a test factory

import org.paramixel.core.Action;
import org.paramixel.core.Paramixel;
import org.paramixel.core.action.Direct;
import org.paramixel.core.action.Sequential;

public class ExampleTest {

@Paramixel.ActionFactory
public static Action actionFactory() {
return Sequential.of(
"ExampleTest",
Direct.of("first", context -> {}),
Direct.of("second", context -> {}));
}
}

Run with Maven

If you added the Paramixel Maven plugin, run:

./mvnw test

The plugin discovers @Paramixel.ActionFactory methods on the test classpath and executes the returned actions.

Run directly from main

import org.paramixel.core.ConsoleRunner;

public static void main(String[] args) {
ConsoleRunner.runAndExit(actionFactory());
}

Check the result programmatically

Action action = ExampleTest.actionFactory();
Runner.builder().build().run(action);

if (action.getResult().getStatus().isPass()) {
System.out.println("passed");
}

Runner.run(action) does not return a Result.

A Runner can execute multiple actions. Each run() call is independent:

Runner runner = Runner.builder().build();
runner.run(firstAction);
runner.run(secondAction);
// Owned executors are created and shut down per run

When you provide your own ExecutorService, the runner uses it but does not manage its lifecycle:

ExecutorService myPool = Executors.newFixedThreadPool(4);
Runner runner = Runner.builder().executorService(myPool).build();
runner.run(action);
myPool.shutdown(); // you are responsible for shutting down