mafia-maven-plugin MAaven FItnesse Adapter
This plugin let's you control:
- STARTING & STOPPING FitNesse.
- RUN TEST(S), SUITE(S), OR TAG FILTERED TESTS.
- CLASSPATH ENTRIES & DEFINITIONS can be written to root page of FitNesse using the pom configuration.
- COLLECT REPORTING.
Supported versions of FitNesse:
- 20150424
- 20150226
- 20140630
- 20140623
- 20140418
- 20140201
- 20131110
- 20131109
- 20130530
- 20130531
- 20121220
- 20111025
**NOTE if you don't want to use the fitnesse version (= latest) that comes with the mafia plugin, please include fitnesse as a dependency of your product. IMPORTANT add the <classifier>standalone</classifier> to include velocity and htmlparser dependencies.
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. | |
fitNesseAuthenticateStart | no auth | username:password - Enforces access for one user or /auth/file/path/and/name - Enforces access for a file of users with encrypted passwords |
fitNesseVerbose | false | Sets verbose option for fitnesse |
logDirectory | ${basedir}/log/ | Where to put and what to call the run log. |
connectionAttempts | 4 | Mafia waits for the startup of FitNesse by trying to connect to it. This configuration determines how often Mafia will attempt. |
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>
<connectionAttempts>4</connectionAttempts>
</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. | |
fitNesseAuthenticateStop | no auth | username:password - Enforces access for user on shutdown |
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 | |
fitNesseAuthenticateStart | no auth | username:password - Enforces access for one user or /auth/file/path/and/name - Enforces access for a file of users with encrypted passwords on startup |
fitNesseAuthenticateStop | no auth | username:password - Enforces access for user on shutdown |
fitNesseUpdatePrevents | update | Prevents (omits) updating FitNesseRoot content |
fitNesseVerbose | not verbose | Sets verbose option for fitnesse |
writeSurefireReports | false | If true, every test result will be written to the folder "surefire-reports" in the maven build directory. This enabled tools like Jenkins to recognize if a test failed. |
connectionAttempts | 4 | Mafia waits for the startup of FitNesse by trying to connect to it. This configuration determines how often Mafia will attempt. |
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>
<writeSurefireReports>false</writeSurefireReports>
<connectionAttempts>4</connectionAttempts>
</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>