Usage

We give some examples on how to use this plugin to generate reports on test stories in your Maven site documentation or as XML files.

Prerequisites

In order to create the reports successfully, the test cases have to be annotated with the @Uut annotation.

For details on how to apply the annotation, please refer to Usage of Annotations.

Collection of Report Data

The information rendered in the report is generated by an APT processor while the test files are compiled. Use the following snippet to execute the APT processor:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <executions>
    <execution>
      <id>default-testCompile</id>
      <configuration>
        <annotationProcessors>
          <annotationProcessor>de.smartics.testdoc.collect.processor.TestDocProcessor</annotationProcessor>
        </annotationProcessors>
        <testCompilerArgument>-Atdoc.exporter.baseDir=${project.build.directory}/testdoc/ser</testCompilerArgument>
      </configuration>
    </execution>
  </executions>
</plugin>

The gathered information will be written to the specified directory (which is the default where the report mojo expects it). If you know that the compile and report rendering is done in one step (e.g. via mvn clean site or the compiler is by other means forced to compile the test sources), there is no need to write the gathered information to disk. In this case replace the testCompilerArgument with

-Atdoc.exporter=de.smartics.testdoc.report.adapter.JmxExportAdapterClient

Due to a class loader issue this will not work for multi project configurations. Please refer to bug 440 for further information.

Please note that due to a bug in the Maven compiler plugin (MCOMPILER-135) it may not be too easy to pass more than one argument to the compiler. The bug report shows an workaround and additional help. In Case Sensitive Language you find an example of the workaround applied.

The annotation parser classes have to be provided on the test class path.

<dependency>
  <groupId>de.smartics.testdoc</groupId>
  <artifactId>testdoc-core</artifactId>
  <version>0.4.0</version>
  <scope>test</scope>
</dependency>

Site Report

To generate one report without technical stories, add the following to the report's section of your pom.xml file:

<plugin>
  <groupId>de.smartics.testdoc</groupId>
  <artifactId>maven-testdoc-report-plugin</artifactId>
  <version>0.4.0</version>
  <reportSets>
    <reportSet>
      <id>standard</id>
      <reports>
        <report>test-stories-report</report>
      </reports>
      <configuration>
        <excludeCategories>
          <exclude>de.smartics.testdoc.categories.Technical</exclude>
        </excludeCategories>
      </configuration>
    </reportSet>
  </reportSets>
</plugin>

Referencing Aggregate Reports

If the report has to reference aggregate report, set the location properties accordingly.

If e.g. the source and Javadoc reports are aggregate reports, use the following in the properties section of your POM:

<properties>
  <xrefLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/../xref</xrefLocation>
  <xrefTestLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/../xref-test</xrefTestLocation>
  <javadocLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/../apidocs</javadocLocation>
  <javadocTestLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/../testapidocs</javadocTestLocation>
</properties>

And then use those properties in the configuration of the plugin:

<configuration>
  <xrefLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/xref</xrefLocation>
  <xrefTestLocation>D:\Projekte\workspaces\projects\smartics-testdoc-tools\target\checkout\testdoc-maven-report-plugin\target\site/xref-test</xrefTestLocation>
  <javadocLocation>${javadocLocation}</javadocLocation>
  <javadocTestLocation>${javadocTestLocation}</javadocTestLocation>
</configuration>

More Examples?

More examples can be found in the navigation menu on the left.