Modules

tapir distinguishes between Inclusion modules and Bootstrap modules. In contrast to Inclusion modules, Bootstrap modules are executable and there can only be one Bootstrap module in your execution classpath.

Spring Boot

tapir relies on Spring Boot and its auto-configuration capabilities. tapir attempts to automatically configure your Test execution based on the jar dependencies that you have added. The AutoConfiguration just collects all available configurations at runtime and weaves them together. The main entry point in tapir’s context is the class which is annotated by @BootstrapConfiguration.

Hint
If you are not familiar with Spring so far, consult the chapter How does it work?
Caution
Take care of the @AutoConfigureOrder annotation. It declares the precedence of the configuration processing. Beans defined in configurations with a higher order value override beans of lower-ordered configurations. For more information on overriding beans, consult the chapter Custom Implementation.

Bootstrap Module

A Bootstrap module has to contain a class which is annotated by @BootstrapConfiguration. This class is the main entry point for the configuration of your test execution environment. You do not have to add anything in this class, unless you would like to customize or extend tapir. These possibilities are convered in the chapter Customiziation.

Beside a Bootstrap Configuration you need a class annotated by @TestClass which contains at least one method which is annotated by @Step. So the most simple setup to run a tapir test looks like this:

import de.bmiag.tapir.bootstrap.annotation.BootstrapConfiguration
 
@BootstrapConfiguration
class MyConfiguration {
}

You also need to include the bootstrap module as dependency.

<dependency>
    <groupId>de.bmiag.tapir</groupId>
    <artifactId>tapir-bootstrap</artifactId>
</dependency>
import de.bmiag.tapir.execution.annotations.step.Step
import de.bmiag.tapir.execution.annotations.testclass.TestClass
 
@TestClass
class MyTest {

    @Step
    def void step1() {
        println("step1 has been executed!")
    }
}

The easisiest way to create a bootstrap module is the corresponding archetype.

Inclusion Module

These modules cannot be executed, but provide some functionality which might (directly or transitively) be used by a Bootstrap module. Like Bootstrap modules, Inclusion modules have a main configuration class as well which is annotated by @ModuleConfiguration.

The @ModuleConfiguration is contained in the bootstrap module.

<dependency>
    <groupId>de.bmiag.tapir</groupId>
    <artifactId>tapir-bootstrap</artifactId>
</dependency>

You don’t need to have any further configuration as BootstrapConfiguration and ModuleConfiguration are aware of Spring’s component-scan capabilities.

The easiest way to create an inclusion module is the corresponding archetype.