Building Java Modules with Blackbox Tests with Test Suites (Incubating) Sample
version 8.11.1
You can open this sample in an IDE that supports Gradle. |
This is an extension of this sample that adds blackbox integration tests.
This sample shows how to adopt an existing sample for use with Test Suites. |
Test Suites are an incubating feature, and the details described here may change. |
Here, the Test Suite Plugin creates an additional source set integrationTest with a module-info.java
.
src
└── integrationTest
└── java
└── module-info.java
We effectively declare a second module that is only used for testing.
The module is open
, which means that it allows reflective access to its classes at runtime as required by JUnit’s test execution engine.
open module org.gradle.sample.integtest.utilities {
requires org.gradle.sample.utilities;
requires org.junit.jupiter.api;
}
This sample does not work in Eclipse when imported using Eclipse Buildship. This is due to a limitation in Eclipse that does not allow more than one module in one project. It you want to do blackbox testing in Eclipse, you should move the integration tests to separate subprojects. |
For more information, see Java Module support in the Java Library Plugin, Java Module support in the Application Plugin and testing Java Modules.