DIRTS is a static class- or method-level Regression Test Selection (RTS) research tool that is aware of Dependency Injection (DI) mechanisms.
- JDK >= 11
- Maven Surefire >= 2.14 (although recommended >= 3.0.0-M5)
- any version of JUnit
Mojo | Description |
---|---|
class_level_select |
Select tests using the class-level approach |
method_level_select |
Select tests using the method-level approach |
Mojo | Description |
---|---|
class_level_graph |
Show graph created by the class-level approach |
method_level_graph |
Show graph created by the method-level approach |
Mojo | Description |
---|---|
clean |
Clean up temporary files and directories |
Option | Description | Default |
---|---|---|
logging |
Logging level (values in java.util.logging.Level ) |
INFO |
useSpringExtension |
Analyze dependencies induced by Spring | false |
useGuiceExtension |
Analyze dependencies induced by Guice | false |
useCDIExtension |
Analyze dependencies induced by CDI | false |
Option | Description | Default |
---|---|---|
standalone |
Run in standalone mode - if not present, DIRTS expects that another RTS-tool has already excluded some tests in the excludesFile |
false |
overrideExtension |
In combination with standalone=false , behave like tool is running standalone but only exclude tests affected by DI-related changes |
false |
Option | Description | Default |
---|---|---|
toFile |
Store graph representation on the filesystem instead of printing it to stdout | false |
outputFile |
The name of the file, where the graph is stored if toFile is set to true |
[class|method]_level |
DIRTS can be used completely standalone for RTS by specifying standalone=true
.
DIRTS can also be used to run after another RTS tool and only correct for tests affected by DI-related changes.
The other tool is required to exclude tests in the file specified by surefire's excludesFile
property.
DIRTS needs to run after the other RTS tool and will then comment out those tests that are affected by DI-related
changes,
but have been excluded before.
This is the default behavior of DIRTS.
DIRTS is built to be used with Maven Surefire. The simplest way to use DIRTS in a Maven project is through the DIRTS Maven plugin:
<plugin>
<groupId>edu.tum.sse.dirts</groupId>
<artifactId>dirts-maven-plugin</artifactId>
<version>${dirts.version}</version>
<configuration>
...
</configuration>
</plugin>
- Surefire's
excludesFile
-property needs to be set, ideally for every submodule separately. Otherwise, test exclusion will not function. - Analysis for the desired DI-frameworks should be enabled, by setting the respective property (
e.g.
useSpringExtension
) totrue
.
Even though DIRTS analyzes plain source code, in case of certain inter-module dependencies, it may be required to compile before executing the selection procedure.
$ mvn compile dirts:class_level_select test
DIRTS creates a list of these modules in .dirts/affected_modules
inside the folder of the outermost module.
$ mvn dirts:class_level_select
$ mvn -am -pl "$(cat .dirts/affected_modules)" test
- Checkout the main branch.
- Run selection to create checksums and graph, if these files do not already exist.
E.g.:
$ mvn dirts:class_level_select
- Checkout the feature branch.
- Run selection and tests.
- For combined compilation, selection and test execution:
$ mvn compile dirts:class_level_select test
- To only compile and test affected modules:
$ mvn dirts:class_level_select
$ mvn -am -pl "$(cat .dirts/affected_modules)" test
To build DIRTS simply run:
$ mvn clean install
This will build the code for all modules, run all tests, and install the JARs to your local Maven repository.