Skip to content

FirstSteps

kiaresch.mussawisade edited this page Jul 6, 2012 · 12 revisions

FirstSteps

This document describes how to use FitGoodies. Using FitGoodies with Maven

FitGoodies is available in mavens central repository. There is no need to setup maven in any special way and you can safely skip this section. However, if you want to, you can can install FitGoodies from source. Creating a project

To create a project that uses fitgoodies, simply copy/type:

mvn archetype:create -DarchetypeVersion=1.2.1 \
-DarchetypeArtifactId=archetype-fitgoodies-quickstart \
-DarchetypeGroupId=de.cologneintelligence \
-DgroupId=org.example -DartifactId=myProject -Dversion=1.0

and replace "org.example" and "myProject" with more specific values. Using FitGoodies in an existing project

To use FitGoodies an an existing project, add the following lines to your pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  ...
  <dependencies>
    <dependency>
      <groupId>de.cologneintelligence</groupId>
      <artifactId>fitgoodies</artifactId>
      <version>1.2.1</version>
    </dependency>
    ...
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <!-- dependencies is optional, use whatever you need -->
        <dependencies>
          <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.1.3.1</version>
          </dependency>
          <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>default</id>
            <phase>integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <inherited>true</inherited>
            <configuration>
              <tasks>
                <property name="tests" value="${basedir}/src/test/fixtures" />
                <property name="target" value="${project.build.directory}/test/fixtures" />
                <property name="reltarget" value="test/fixtures" />
                
                <copy todir="${target}">
                  <fileset dir="${tests}" erroronmissingdir="false"
                           casesensitive="false" excludes="**/*.html" />
                </copy>
                
                <java classname="de.cologneintelligence.fitgoodies.runners.DirectoryRunner" 
                      dir="${project.build.directory}"
                      fork="true" failonerror="true">
                  <classpath>
                    <path refid="maven.test.classpath" />
                  </classpath>
                  <arg value="${tests}" />
                  <arg value="${reltarget}" />
                  <arg value="utf-8" />
                </java>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
      ...
    </plugins>
  </build>
</project>

Running the tests

To execute the tests, run

mvn integration-test

Using FitGoodies without Maven Installing FitGoodies

This document assumes, that you already have fitgoodies.jar. If you do not have it, you can download it from SourceForge or build it from source. Running tests

To use FitGoodies, you need fit.jar and fitgoodies.jar in your CLASSPATH. Fit can be downloaded at fit.c2.com.

There are several ways to run Fixtures. If you have the libs in lib/ and want to generate reports from all HTML files in fit-testsuite/, run this command:

$ mkdir reports
$ java -classpath lib/fit.jar:lib/fitgoodies.jar de.cologneintelligence.fitgoodies.runners.AutoRunner fit-testsuite/ reports/

If you rather would like to analyze only one file, you can specify that too:

$ mkdir reports
$ java -classpath lib/fit.jar:lib/fitgoodies.jar de.cologneintelligence.fitgoodies.runners.AutoRunner fit-testsuite/simpletests.html reports/simpletests.html

Optionally, you can specify the encoding as an optional third parameter:

$ mkdir reports
$ java -classpath lib/fit.jar:lib/fitgoodies.jar de.cologneintelligence.fitgoodies.runners.AutoRunner fit-testsuite/ reports/ utf-16
Clone this wiki locally