com.soebes.itf.jupiter.extension:itf-executor

This POM contains the default configuration for all projects which are located in com.soebes

License

License

GroupId

GroupId

com.soebes.itf.jupiter.extension
ArtifactId

ArtifactId

itf-executor
Last Version

Last Version

0.7.0
Release Date

Release Date

Type

Type

jar
Description

Description

This POM contains the default configuration for all projects which are located in com.soebes
Project Organization

Project Organization

SoftwareEntwicklung Beratung Schulung

Download itf-executor

How to add to project

<!-- https://jarcasting.com/artifacts/com.soebes.itf.jupiter.extension/itf-executor/ -->
<dependency>
    <groupId>com.soebes.itf.jupiter.extension</groupId>
    <artifactId>itf-executor</artifactId>
    <version>0.7.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.soebes.itf.jupiter.extension/itf-executor/
implementation 'com.soebes.itf.jupiter.extension:itf-executor:0.7.0'
// https://jarcasting.com/artifacts/com.soebes.itf.jupiter.extension/itf-executor/
implementation ("com.soebes.itf.jupiter.extension:itf-executor:0.7.0")
'com.soebes.itf.jupiter.extension:itf-executor:jar:0.7.0'
<dependency org="com.soebes.itf.jupiter.extension" name="itf-executor" rev="0.7.0">
  <artifact name="itf-executor" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.soebes.itf.jupiter.extension', module='itf-executor', version='0.7.0')
)
libraryDependencies += "com.soebes.itf.jupiter.extension" % "itf-executor" % "0.7.0"
[com.soebes.itf.jupiter.extension/itf-executor "0.7.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Integration Testing Framework Extension

Apache License, Version 2.0, January 2004 javadoc JDKBuilds Main Site Issues Issues Closed

Quality Gate Status Coverage

Release Maven Central Release Notes Users Guide
0.9.0 Maven Central PDF PDF
HTML HTML
0.10.0-SNAPSHOT Maven Central PDF PDF
HTML HTML

State

The project is in an early state but already being useful and can be used for real testing. The project release is available via Central repository (only the given version as show in above table) which makes it easy for you to use it out without the need to compile the code (You can of course do that if you like) yourself.

General Overview

The basic thing about integration testing of Maven Plugins / Maven Extensions etc. is currently that the existing solutions are not a very concise and comprehensive which is based on the long development history of the Apache Maven project. There are a lot of different approaches done over the time but from my perspective they all lack one thing: Simplicity. More detailed reasons etc. can be read in the Background Guide. This is the reason why I think it's time to come up with a more modern setup and started this project.

The Basic Idea

The basic idea rest upon the option to write custom extension with JUnit Jupiter for JUnit Jupiter testing framework which makes it very easy to get things done.

So in general the whole Integration Testing Framework in its core (itf-jupiter-extension) is a JUnit Jupiter extension which delivers supplemental support for a testing framework in general and in particular for using integration tests. Of course there is a lot of convenience integrated into it to make integration testing of Maven plugins easier.

Quick Start

The General Requirements

The requirements to write integration tests with the integration testing framework are the folloing:

  • JDK8+
  • Apache Maven 3.1.0 or above.

The Maven Configuration

The first thing before you can run integration tests is to add the following dependencies (as minimum) to your pom.xml:

<project..>
   ...
  <dependencies>
    ..
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-jupiter-extension</artifactId>
      <version>0.9.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  ..
</project..>

The first dependency org.junit.jupiter:junit-jupiter-engine is needed for JUnit Jupiter (We recommend the most recent version) working and the second one com.soebes.itf.jupiter.extension:itf-jupiter-extension is the extension to get support for running in general integration tests as described later.

The next part is to add itf-maven-plugin in your pom.xml file like this which handles the first part which is involved:

<project...>
  ..
  <build>
  ..
    <plugin>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-maven-plugin</artifactId>
      <version>0.9.0</version>
      <executions>
        <execution>
          <id>installing</id>
          <phase>pre-integration-test</phase>
          <goals>
            <goal>install</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  ..
  </build>
  ..
</project...>

The given version of itf-jupiter-extension as well as itf-maven-plugin should always be the most recent version which is available via Central repository.

Based on the concept we would like to run integration identified by the naming convention we have to add the maven-failsafe-plugin to the pom.xml like this (This will execute the integration tests which checks the functionality; The second part which is involved).

<project...>
  ..
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
      <!--
       ! currently needed to run integration tests.
      -->
      <systemProperties>
        <maven.version>${maven.version}</maven.version>
        <maven.home>${maven.home}</maven.home>
      </systemProperties>
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>integration-test</goal>
          <goal>verify</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</project...>

Finally, you have to add the configuration to copy the projects which are the test cases by adding the following (part 3 of the involved parties):

<project...>
  <build>
    ..
    <testResource>
      <directory>src/test/resources-its</directory>
      <filtering>true</filtering>
    </testResource>
  ..
  </build>
 ..
</project...>

Details about the given configuration can be read in the users guide.

The Involved Parties

Writing an integration test for a Maven plugin means you have to have three parties:

  1. The component you would like to test (typically a Maven plugin etc.).
  2. The testing code where you check the functionality.
  3. The Project you would like to test with (where your Maven plugin usually is configured in to be used.)

The Component code

The component you write is located in your project in the usual location. This is of course only an example of how it looks like in reality (usually more classes etc.):

.
└── src/
    └── main/
        └── java/
            └── org/
                └── plugin/
                    └── PluginMojo.java

The Testing Code

The structure for an integration tests follows of course the convention over configuration paradigm. Based on the conventions in Maven an integration test should be named like *IT.java and be located in the directory structure as follows:

.
└── src/
    └── test/
        └── java/
            └── org/
                └── it/
                    └── FirstMavenIT.java

So now the real a test code looks like this:

package org.it;

import static org.assertj.core.api.Assertions.assertThat;

import com.soebes.itf.jupiter.extension.MavenJupiterExtension;
import com.soebes.itf.jupiter.extension.MavenTest;
import com.soebes.itf.jupiter.maven.MavenExecutionResult;

@MavenJupiterExtension // <1>
class FirstMavenIT {

  @MavenTest // <2>
  void the_first_test_case(MavenExecutionResult result) { //<3>
    assertThat(result).build().isSuccessful(); // <4>
  }

}
  1. Maven Integration test annotation.
  2. Maven Test Annotation.
  3. Injected execution result
  4. Custom assertions to check the result of the build.

The Project to Test With

The project you would like to use as a foundation for your test of the plugin. This is located in a special location under src/test/resources-its/... This is needed to prevent the confusion with the usual src/test/resources in particular related to filtering etc. (details about the setup etc. in the users guide).

.
└── src/
    └── test/
        └── resources-its/
            └── org/
                └── it/
                    └── FirstMavenIT/
                        └── the_first_test_case/
                            ├── src/
                            └── pom.xml

The Executed Test

After execution of the integration test the result will look like this:

.
└──target/
   └── maven-it/
       └── org/
           └── it/
               └── FirstMavenIT/
                   └── the_first_test_case/
                       ├── .m2/
                       ├── project/
                       │   ├── src/
                       │   ├── target/
                       │   └── pom.xml
                       ├── mvn-stdout.log
                       ├── mvn-stderr.log
                       ├── mvn-arguments.log
                       └── orther logs.

This gives you a first impression how an integration test can look like. There are a lot of example in this project available and of course I strongly recommend reading the documentation (I know I don't like reading documentation either).

Conclusion

If you like the framework don't hesitate to test and give feedback in particular if things don't work as described or as you expected them to work.

Building

If you like to build the project from source yourself you need the following:

  • JDK 8+
  • Apache Maven 3.6.3

The whole project can be built via:

mvn clean verify

This will take some time cause there are already integration tests in the itf-examples project which are executed and real integration tests for the itf-maven-plugin which is a bootstrap (eat-your-own-dog-food) to use already parts of the framework (JUnit Jupiter extension) to make the development of the plugin easier.

Concept and Background Guide

The concept guide decribe my ideas I have in mind (just not to forget them). It is neither a roadmap nor about future releases etc. It's only intended to keep my ideas at a central location.

  • PDF
  • HTML

The background guide is a conclusion about the reason why I have started this project.

  • PDF
  • HTML

GitHub Pages

Currently we have two states of site:

Versions

Version
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0