Overview
Connect Anvil to a test framework, build tool, or IDE and choose how your environments run.
Anvil's integrations serve different parts of a test workflow. Choose the test framework that owns your assertions and the build tooling that prepares and runs them.
| Integration | Responsibility |
|---|---|
| JUnit Jupiter | Select a scenario with @AnvilTest, start it before each test, inject ScenarioContext, and close it afterwards. |
| Gradle | Resolve dependencies and registered artifacts, compile scenario sources, configure execution, and provide test and foreground tasks. |
| IntelliJ IDEA | Discover project scenarios, save run configurations, and inspect or control live environments from the IDE. |
| Embedding | Let a Java application own the engine and context lifetimes directly |
JUnit's scenario lifecycle can be used wherever JUnit Jupiter runs with the required Anvil runtime
dependencies. Gradle configures that runtime for its anvilTest task and also supplies foreground
scenario tooling that can run without JUnit.
Choose a combination
| Workflow | Install |
|---|---|
| Embedded Java application | me.whereareiam.anvil:launcher and the required runtime providers |
| JUnit with any build tool | me.whereareiam.anvil:junit and the required runtime providers |
| Gradle scenarios and IDE discovery | me.whereareiam.anvil Gradle plugin |
| Gradle JUnit tests | me.whereareiam.anvil.junit Gradle plugin |
| Gradle tests and interactive scenarios | Both Gradle plugins |
| IntelliJ scenario controls | Anvil IDE plugin plus a declared project runtime; standard Anvil Gradle plugin supplies that declaration |
Library consumers can import me.whereareiam.anvil:bom to align Anvil versions. Applying a Gradle
integration is optional when running JUnit or embedding the launcher. Gradle adapters supply the
build-specific wiring; the JUnit runtime does not load Gradle or IntelliJ code. IntelliJ's optional
Gradle adapter reads project declarations without requiring JUnit in the scenario runtime.
Use Gradle with JUnit
- Select Gradle plugins and dependencies for your environment.
- Configure build settings and artifacts.
- Choose a scenario through JUnit selection and context injection.
- Run the tests with Gradle and inspect the results.
The first test walks through this path with a complete example. Use manual environments for interactive sessions, or embed Anvil to own the engine and context directly.