Anvil
Integrations

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.

IntegrationResponsibility
JUnit JupiterSelect a scenario with @AnvilTest, start it before each test, inject ScenarioContext, and close it afterwards.
GradleResolve dependencies and registered artifacts, compile scenario sources, configure execution, and provide test and foreground tasks.
IntelliJ IDEADiscover project scenarios, save run configurations, and inspect or control live environments from the IDE.
EmbeddingLet 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

WorkflowInstall
Embedded Java applicationme.whereareiam.anvil:launcher and the required runtime providers
JUnit with any build toolme.whereareiam.anvil:junit and the required runtime providers
Gradle scenarios and IDE discoveryme.whereareiam.anvil Gradle plugin
Gradle JUnit testsme.whereareiam.anvil.junit Gradle plugin
Gradle tests and interactive scenariosBoth Gradle plugins
IntelliJ scenario controlsAnvil 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

  1. Select Gradle plugins and dependencies for your environment.
  2. Configure build settings and artifacts.
  3. Choose a scenario through JUnit selection and context injection.
  4. 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.

On this page