Class GenerateDriverMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.gematik.test.tiger.maven.adapter.mojos.GenerateDriverMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="generate-drivers", defaultPhase=GENERATE_TEST_SOURCES) public class GenerateDriverMojo extends org.apache.maven.plugin.AbstractMojo
This plugin allows to generate JUnit4 driver classes for Serenity testruns dynamically in the generate-test-sources phase. To trigger use the "generate-drivers" goal. For more details please referr to the README.adoc file in the project root.
  • Field Details

    • skip

      @Parameter private boolean skip
      Skip running this plugin. Default is false.
    • featuresDir

      @Parameter(alias="basedir", defaultValue="${basedir}/src/test/resources/features") private String featuresDir
      Optional base directory for each file to replace. Path to base relative feature files from. This feature is useful for multi-module projects. Defaults to ${}basedir}/src/test/resources/features.
    • includes

      @Parameter(required=true, defaultValue="**/*.feature") private List<String> includes
      Mandatory List of files to include. In Ant format (*\/directory/**.feature)
    • excludes

      @Parameter private List<String> excludes
      Optional List of files to exclude. In Ant format (*\/directory/**.feature)
    • glues

      @Parameter(defaultValue="${project.groupId}") private List<String> glues
      Mandatory list of packages containing glue code or hooks
    • driverPackage

      @Parameter(defaultValue="de.gematik.test.tiger.serenity.drivers") private String driverPackage
      Optional name of the java package the driver class should be generated in. Default is "de.gematik.test.tiger.serenity.drivers"
    • driverClassName

      @Parameter(defaultValue="Driver${ctr}IT") private String driverClassName
      Optional name of the driver class. MUST contain the token '${ctr}' which gets replaced on execution with a unique counter incremented for each feature file. Default is "Driver${ctr}"
    • targetFolder

      @Parameter(defaultValue="${project.build.directory}", readonly=true) private String targetFolder
      Optional target directory. Default value is "${project.build.directory}"
    • templateFile

      @Parameter private File templateFile
      Optional path to a custom template file to be used for generating the driver Java source code file. Currently supports the following list of tokens:

      • ${ctr} ... counter value that is unique and incremented for each feature file.
      • ${package} ... this is where the package declaration of the driver class will be added to. Either empty or of the pattern "package xxx.yyy.zzz;" where xxx.yyy.zzz is replaced with the configured driverPackage configuration property.
      • ${driverClassName} ... name of the driver class (with the ctr token already being replaced by the counter value).
      • ${feature} ... path to the feature file.
      • ${glues} ... comma separated list of glue/hook packages as specified by the glues configuration property
    • junit5Driver

      @Parameter private boolean junit5Driver
    • project

      @Parameter(property="project", readonly=true, required=true) private org.apache.maven.project.MavenProject project
      The current project representation.
  • Constructor Details

    • GenerateDriverMojo

      public GenerateDriverMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • checkParams

      private void checkParams() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • addBasedirPrefix

      private String addBasedirPrefix(String file)