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 Summary
FieldsModifier and TypeFieldDescriptionprivate StringOptional name of the driver class.private StringOptional name of the java package the driver class should be generated in.Optional List of files to exclude.private StringOptional base directory for each file to replace.Mandatory list of packages containing glue code or hooksMandatory List of files to include.private booleanprivate org.apache.maven.project.MavenProjectThe current project representation.private booleanSkip running this plugin.private StringOptional target directory.private FileOptional path to a custom template file to be used for generating the driver Java source code file.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringaddBasedirPrefix(String file) private voidvoidexecute()Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
skip
@Parameter private boolean skipSkip running this plugin. Default is false. -
featuresDir
@Parameter(alias="basedir", defaultValue="${basedir}/src/test/resources/features") private String featuresDirOptional 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
Mandatory List of files to include. In Ant format (*\/directory/**.feature) -
excludes
Optional List of files to exclude. In Ant format (*\/directory/**.feature) -
glues
Mandatory list of packages containing glue code or hooks -
driverPackage
Optional name of the java package the driver class should be generated in. Default is "de.gematik.test.tiger.serenity.drivers" -
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
Optional target directory. Default value is "${project.build.directory}" -
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 projectThe 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
-