Code Monkey home page Code Monkey logo

dirts's Introduction

DIRTS (Dependency Injection Aware Regression Test Selection)

CI

DIRTS is a static class- or method-level Regression Test Selection (RTS) research tool that is aware of Dependency Injection (DI) mechanisms.

Prerequisites

  • JDK >= 11
  • Maven Surefire >= 2.14 (although recommended >= 3.0.0-M5)
  • any version of JUnit

Maven Goals

Select Mojos

Mojo Description
class_level_select Select tests using the class-level approach
method_level_select Select tests using the method-level approach

Graph Mojos

Mojo Description
class_level_graph Show graph created by the class-level approach
method_level_graph Show graph created by the method-level approach

Utility Mojos

Mojo Description
clean Clean up temporary files and directories

Configuration Options

Relevant for every mojo

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

Relevant for select mojos

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

Relevant for graph mojos

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

Use cases

Standalone

DIRTS can be used completely standalone for RTS by specifying standalone=true.

As an extension to another RTS tool

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.

Usage examples

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>

Prerequisites

  1. Surefire's excludesFile-property needs to be set, ideally for every submodule separately. Otherwise, test exclusion will not function.
  2. Analysis for the desired DI-frameworks should be enabled, by setting the respective property ( e.g. useSpringExtension) to true.

Compile, select and test in one go

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

Select, then compile and test only those modules that have at least one test selected

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

Combined with git - Test selection before merging

  1. Checkout the main branch.
  2. Run selection to create checksums and graph, if these files do not already exist. E.g.: $ mvn dirts:class_level_select
  3. Checkout the feature branch.
  4. 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

Setup

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.

dirts's People

Contributors

delsner avatar hundsdor avatar pstoeckle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dirts's Issues

[Feature] Improve recognition of test suites

Instead of looking for (sometimes complicated) patterns (like @Test) in source code, it would be better to simply apply a regex filter to the name of classes like surefire does.

[Feature] Add the ability to manually add edges through annotations

Manually adding edges to the DependencyGraph through annotations, could be useful in case a developer would want to increase safety in certain situations (for example DI) manually.
E.g.:

@DependsOn(RandomClass.class, "randomMethod")
@DependsOnFile("/path/to/random.file")

Adding edges to Types/NonTypes in this way should be quite simple.
Edges to files require more adaptations, since changes to arbitrary files are currently not recognized.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.