Usage - Maven Plugin

Note

Note: The plugin does not work with the FitLibrary so you are limited to using fixtures defined in the standard fit library.

http://jira.codehaus.org/browse/MFIT-6.

Install

See Install for the pom.xml dependency.

Setup Tests

Tests need to be created within the Maven project folder:

src/main/fit/

Sample ColumnFixture

To get a very simple test working:

Class

Create this class:

import fit.ColumnFixture;

public class Division extends ColumnFixture {
      public float numerator;
      public float denominator;
      public float quotient() {
              return numerator / denominator;
      }
}

html

Copy this html file (generated by Microsoft Word):

../../misc/howto/fit/egFixture.html

…to:

src/main/fit/

Configuration

Add the following configuration to your pom.xml file:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>fit-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>fixture</id>
          <phase>integration-test</phase>
          <configuration>
            <sourceDirectory>src/main/fit</sourceDirectory>
            <caseSensitive>true</caseSensitive>
            <sourceIncludes>**/*Fixture.html</sourceIncludes>
            <sourceExcludes>**/Wiki*</sourceExcludes>
            <parseTags>
              <parseTag>table</parseTag>
              <parseTag>tr</parseTag>
              <parseTag>td</parseTag>
            </parseTags>
            <outputDirectory>target/fit</outputDirectory>
          </configuration>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
        <execution>
          <id>wiki-fixture</id>
          <phase>integration-test</phase>
          <configuration>
            <sourceDirectory>src/main/fit</sourceDirectory>
            <caseSensitive>true</caseSensitive>
            <sourceIncludes>**/WikiFixture.html</sourceIncludes>
            <parseTags>
              <parseTag>wiki</parseTag>
              <parseTag>table</parseTag>
              <parseTag>tr</parseTag>
              <parseTag>td</parseTag>
            </parseTags>
            <outputDirectory>target/fit</outputDirectory>
          </configuration>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Run

mvn integration-test

Issues

The following error is caused by running using Java 1.4:

[INFO] [fit:run {execution: fixture}]
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] java.util.Arrays.toString([Ljava/lang/Object;)Ljava/lang/String;
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError: java.util.Arrays.toString([Ljava/lang/Object;)Ljava/lang/String;
        at org.codehaus.mojo.fit.FitRunnerMojo.execute(FitRunnerMojo.java:106)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)

Use Java 1.5 (or above) and you will be fine.