Usage

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.

Configuration

To generate the XML reports, simply specify the plugin in the build section of your pom.xml:

<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>

<plugin>
  <groupId>de.smartics.testdoc</groupId>
  <artifactId>testdoc-maven-plugin</artifactId>
  <version>${project.version}</version>
  <executions>
    <execution>
      <id>testdoc</id>
      <goals>
        <goal>test-stories</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Start Generation

The generation is started with the process-test-classes phase:

mvn process-test-classes

XML Report

The generated report then links like this:

<testdoc>">
  <uut>de.smartics.testdoc.report.export.XmlExporter</uut>
  <scenarios>
    <scenario>
      <testCase>de.smartics.testdoc.report.export.XmlExporterTest</testCase>
      <testName>writesTestDocsWithNoScenarios</testName>
      <sentence>Writes test docs with no scenarios.</sentence>
    </scenario>
    <scenario>
      <testCase>de.smartics.testdoc.report.export.XmlExporterTest</testCase>
      <testName>writesTestDocsWithOneScenario</testName>
      <sentence>Writes test docs with one scenario.</sentence>
    </scenario>

    ...

  </scenarios>
</testdoc>

Note: Each serialized file in the ser folder contains the information of one test case type. The XML report files in the xml folder contain test information of one production class, the unit under test (UUT).