View on GitHub

Mafia-maven-plugin

FitNesse plugin for maven

Download this project as a .zip file Download this project as a tar.gz file

This is a maven plugin for FitNesse.

mafia-maven-plugin MAaven FItnesse Adapter

This plugin let's you control:

1 - STARTING FitNesse.

goal: start
phase: install
command: mvn mafia:start

This maven goal will start the FitNesse server. You can create a configuration section in your pom to change default behaviour.
Configuration:

Property Default Description
fitNessePort 9090 Port for FitNesse to listen on.
wikiRoot ${basedir} Root of FitNesse.
nameRootPage FitNesseRoot Name of the root page
retainDays 14 Number of days to retain older versions (.zip files)
jvmArguments Arguments for the jvm.
jvmDependencies Classpath entries for the jvm.
logDirectory ${basedir}/log/ Where to put and what to call the run log.
Configuration example with defaults and example values:
  
    <plugin>
        <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
        <artifactId>mafia-maven-plugin</artifactId>
        <configuration>
            <fitNessePort>9090</fitNessePort>
            <wikiRoot>${basedir}</wikiRoot>
            <nameRootPage>FitNesseRoot</nameRootPage>
            <retainDays>14</retainDays>
            <jvmArguments>
                <jvmArgument>CM_SYSTEM=fitnesse.wiki.cmSystems.GitCmSystem</jvmArgument>
            </jvmArguments>
            <jvmDependencies>
                <dependency>
                    <groupId>nl.abc.fitnesse</groupId>
                    <artifactId>fitnesse-plugin</artifactId>
                </dependency>
            </jvmDependencies>
            <log>${basedir}/log/</log>
        </configuration>
     </plugin>
  
2 - STOPPING FitNesse.
goal: stop
phase: clean
command: mvn mafia:stop

This maven goal will stop the FitNesse server. You can create a configuration section in your pom to change default behaviour.
Configuration:
Property Default Description
fitNessePort 9090 Port for FitNesse to listen on.
jvmArguments Arguments for the jvm.
jvmDependencies Classpath entries for the jvm.
Configuration example with defaults and exmaple values:
  
    <plugin>
        <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
        <artifactId>mafia-maven-plugin</artifactId>
        <configuration>
            <fitNessePort>9090</fitNessePort>
            <jvmArguments>
                <jvmArgument>CM_SYSTEM=fitnesse.wiki.cmSystems.GitCmSystem</jvmArgument>
            </jvmArguments>
            <jvmDependencies>
                <dependency>
                    <groupId>nl.abc.fitnesse</groupId>
                    <artifactId>fitnesse-plugin</artifactId>
                </dependency>
            </jvmDependencies>
        </configuration>
    </plugin>
  
3 - RUN TEST(S), SUITE(S), OR TAG FILTERED TESTS.
goal: test
phase: integration-test
command: mvn mafia:test

This maven goal will run the tests listed in the configuration section. Note that the tests are run on a FitNesse server running on separate port, default 9091.
Configuration:
Property Default Description
fitNesseRunPort 9091 Port for FitNesse to listen on.
jvmArguments Arguments for the jvm.
jvmDependencies Classpath entries for the jvm.
testResultsDirectory ${basedir}/FitNesse/files/mafiaTestResults Output directory for the mafia test results.
stopTestsOnIgnore false Stop the run when an ignore exception occurs.
stopTestsOnException true Stop the run when an exception occurs.
stopTestsOnWrong true Stop the run when a wrong exception occurs.
tests List of elements with tests.
suites List of elements with suites.
suitePageName Root page of filtered suites to run.
suiteFilter tag filter to use. Used in combination with a suitePageName
Configuration with defaults. tests, suites and a suiteFilter can be mixed. A suiteFilter needs a suitePageName.
  
    <plugin>
        <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
        <artifactId>mafia-maven-plugin</artifactId>
        <configuration>
            <fitNesseRunPort>9091</fitNesseRunPort>
            <jvmArguments>
                <jvmArgument>CM_SYSTEM=fitnesse.wiki.cmSystems.GitCmSystem</jvmArgument>
            </jvmArguments>
            <jvmDependencies>
                <dependency>
                    <groupId>nl.abc.fitnesse</groupId>
                    <artifactId>fitnesse-plugin</artifactId>
                </dependency>
            </jvmDependencies>
            <testResultsDirectory>${project.build.directory}/fitnesse/</testResultsDirectory>
            <stopTestsOnIgnore>false</stopTestsOnIgnore>
            <stopTestsOnException>true</stopTestsOnException>
            <stopTestsOnWrong>true</stopTestsOnWrong>
            <tests>
                <test>FrontPage.IntegrationTest</test>
                <test>...</test>
            </tests>
            <suites>
                <suite>FrontPage.IntegrationSuite</suite>
                <suite>...</suite>
            </suites>
            <suitePageName>FrontPage.SomeSuite</suitePageName>
            <suiteFilter>critical_tests</suiteFilter>
        </configuration>
    </plugin>
  
4 CLASSPATH ENTRIES & DEFINITIONS.
goal: content
phase: process-resources
command: mvn mafia:content

This maven goal will create the content.txt file, root page, for FitNesse, filling it with classpath entries (!path ) and definitions (!define ). Automatically including the compile and runtime dependencies, but you can exclude dependencies in the configuration.
Configuration:
Property Default Description
wikiRoot ${basedir} Root of FitNesse.
nameRootPage FitNesseRoot Name of the root page
statics Values ares copied as is to content.txt (This could also be wiki text)
resources Values are prefixed with !define and copied to content.txt
targets Values are prefixed with !define and postfixed with /target/classes/ and added to content.txt (useful for hot-deployment).
excludeDependencies Listed dependencies are excluded from the classpath entries. (Most likely the ones listed in the targets configuration section).

Example:

  
    <plugin>
        <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
        <artifactId>mafia-maven-plugin</artifactId>
        <configuration>
            <wikiRoot>${basedir}</wikiRoot>
            <nameRootPage>FitNesseRoot</nameRootPage>
            <statics>
                <static>!define TEST_SYSTEM {slim}</static>
            </statics>
            <resources>
                <resource>/resource_location/resources/</resource>
            </resources>
            <targets>
                <target>../application-to-test/</target>
            </targets>
            <excludeDependencies>
                <dependency>
                    <groupId>nl.abc.dependency</groupId>
                    <artifactId>some-artifact</artifactId>
                    <version>1.0.0</version>
                </dependency>
            </excludeDependencies>
        </configuration>
    </plugin>
  

5 - COLLECT REPORTING.

goal: report
phase: site

command: mvn mafia:report

This maven goal will generate a report of the last run tests.
Configuration:

Property Default Description
wikiRoot ${basedir} Root of FitNesse.
nameRootPage FitNesseRoot Name of the root page

Configuration with defaults:

  
    <reporting>
        <plugins>
            <plugin>
                <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
                <artifactId>mafia-maven-plugin</artifactId>
                <configuration>
                    <wikiRoot>${basedir}</wikiRoot>
                    <nameRootPage>FitNesseRoot</nameRootPage>
                </configuration>
            </plugin>
        </plugins>
    </reporting>