Code Monkey home page Code Monkey logo

mafia-maven-plugin's Introduction

THIS PLUGIN IS NO LONGER ACTIVELY MAINTAINED. Feel free to send merge request. If anybody would like to maintain this plugin, please contact me and YOU could become the owner!

This is a maven plugin for FitNesse.

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>
 

mafia-maven-plugin's People

Contributors

andreas-kehl avatar aneesh-joseph avatar phauer avatar sijpesteijn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mafia-maven-plugin's Issues

Mafia Plugin not working with current version of fitnesse

hi,
we have some problems running Mafia Plugin with the current fitnesse version 20161106. with the fitnesse version 20150424 everything runs fine. do you have any idea?
we get errors like this:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at org.jsoup.select.Elements.get(Elements.java:523) at nl.sijpesteijn.testing.fitnesse.plugins.report.MafiaReportBuilder.withTests(MafiaReportBuilder.java:87) at nl.sijpesteijn.testing.fitnesse.plugins.FitNesseRunnerMojo.execute(FitNesseRunnerMojo.java:228) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more

Full Stacktrace:
[ERROR] Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test (mafia-test) on project datasource: Execution mafia-test of goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test failed: Index: 0, Size: 0 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test (mafia-test) on project datasource: Execution mafia-test of goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test failed: Index: 0, Size: 0 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution mafia-test of goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test failed: Index: 0, Size: 0 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at org.jsoup.select.Elements.get(Elements.java:523) at nl.sijpesteijn.testing.fitnesse.plugins.report.MafiaReportBuilder.withTests(MafiaReportBuilder.java:87) at nl.sijpesteijn.testing.fitnesse.plugins.FitNesseRunnerMojo.execute(FitNesseRunnerMojo.java:228) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more [ERROR]

FitnesseTestRunner instantiation gets wrong argument in FitNesseRunnerMojo

Hi,

In FitNesseRunnerMojo, when you instantiate the FitNesseTestRunner object, you pass the "stopTestsOnIgnore" argument twice:

final FitNesseTestRunner runner = new FitNesseTestRunner(testCaller, stopTestsOnIgnore, stopTestsOnException, stopTestsOnIgnore, getLog());

The second "stopTestsOnIgnore" argument should be "stopTestsOnWrong".

Option to rerun run failing tests.

When running tests in spin offs like xebium, tests are marked failed but are actually succesful. Having a retry option to rerun the failing tests x times would show more realiable results.

Starting FitNesse fails when unpacking new version takes more than 3 seconds

Hi,

I'm using the latest version of the plugin and trying to run FitNesse tests in Jenkins. But if unpacking FitNesse doesn't finish within a given time (3 secs), the following error appears in console:

[INFO] --- mafia-maven-plugin:2.1.0:test (run-tests) @ ---
[INFO] Starting FitNesse. This could take some more seconds when first used....
[ERROR] Unpacking new version of FitNesse resources. Please be patient
mojoFailed nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.0(run-tests)
projectFailed

The waitForProcess() method in the FitNesseCommander defines the interval that we should wait when the resources are unpacked:

if (inputMonitor.isFinished()) {
if (errorMonitor.getBuffer().toString().endsWith("Unpacking new version of FitNesse resources. Please be patient.")) {
Thread.sleep(3000); } return; }

Would that be possible to make this value configurable?

Result file of the suite not written when test are not passing - Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins instead

Hi, when a suite finish with some errors and exceptions:

[INFO] FitNesse start on: http://localhost:9090
[INFO] Starting test run....
[INFO] SaIntegrationTest failed with wrong exception.
[INFO] Test: SaIntegrationTest(39 right, 34 wrong, 5 ignored, 33 exceptions, file: 20160707172042_39_34_5_33.xml)
[INFO] Finished test run.

The build finish with this error, and the xml result file of the whole suite are not written. The file 20160707172042_39_34_5_33.xml is not there.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:19 min
[INFO] Finished at: 2016-07-07T17:20:42+01:00
[INFO] Final Memory: 38M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test (run-fitnesse-tests) on project integration-fitnesse-fixtures: Test run interrupted by stop conditions. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.11:test (run-fitnesse-tests) on project integration-fitnesse-fixtures: Test run interrupted by stop conditions.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Test run interrupted by stop conditions.
    at nl.sijpesteijn.testing.fitnesse.plugins.FitNesseRunnerMojo.execute(FitNesseRunnerMojo.java:239)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
[ERROR] 

We can avoid that with:

<stopTestsOnException>false</stopTestsOnException>
<stopTestsOnWrong>false</stopTestsOnWrong>

In this case the we got the xml result of the full test suite but the build appears SUCCESS.

Is it possible to get the full result even if some issues appear during the test and end with FAILURE to show that the tests didn't pass but avoid this ambiguous message [ERROR] Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin ?

how to generate html reports

hi,

when i run my fitnesse tests using mafia:test it creates a fitnesse_results.xml
I would like to see the reuslts in html format. can you please direct me to the documentation related to the same.

thanks,
vivek

Generate dependency content.txt with mafia:start

Hi,
is it possible to (re-)generate the content.txt with the dependency inclusions automatically if i use mvn mafia:start? This file is normally produced with mvn mafia:content.

Or is there currently a way to do/configure it in one step?

With best regards,
f4n

Thread.sleep is unreachable when fitnesse is unpacking during start

Hi Gijs,

Thanks for the latest fixes!

However, I've found one more error around handling of the "Unpacking new version of FitNesse resources. Please be patient." error message (Actually I've found this issue earlier but I totally forgot to report it with the others).

In FitNesseCommander:
if (errorMonitor.getBuffer().toString().endsWith("Unpacking new version of FitNesse resources. Please be patient."))
{
Thread.sleep(commanderConfig.getUnpackWaitTime());
}

But the toString method of the error monitor buffer returns with: "Unpacking new version of FitNesse resources. Please be patient.\r" (There is an extra whitespace char at the end of the string)

Therefore the sleep is unreachable. A trim on the output could solve this issue.

Thanks in advance!

Connecting Fitnesse to remote server

Mafia maven plugin works if we connect fitnesse from local host. Is there any way to connect to remote fitnesse by giving hostname in pom.xml or do we have any other plugin

Using IPaddress instead of localhost

Instead of using localhost to run the fitnesse can we use the IP address .
In some CI server or other place where we cannot Configure mapping for the system property (“localhost”).Can we indicate the plugin to pick up the ipAdddress instead of localhost.
thanks
For example:
In FitNesseRunnerMojo
/**
* The replace localHost with ip address on which FitNesse is running the tests.
*/
@parameter(property = "useIPAddress", defaultValue ="false")
private boolean useIPAddress;

private String getIpAddress() throws SocketException, UnknownHostException {
    final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
    for (final NetworkInterface networkInterface : Collections.list(networkInterfaces)) {
        if (!networkInterface.isLoopback()) {
            final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
            for (final InetAddress inetAddress : Collections.list(inetAddresses)) {
                if (inetAddress instanceof Inet4Address) {
                    return inetAddress.getHostAddress();
                }
            }
        }
    }
    return null;
}

/**
 * {@inheritDoc}
 */
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
    getLog().debug(toString());
    if (!skip) {

        if (fitNesseRunPort == -1) {
            fitNesseRunPort = getAvailablePort();
        }

        if (startServer) {
            startCommander();
        }
        getLog().info("Starting test run....");
        try {
            outputDirectory = getWikiRoot() + File.separator + getNameRootPage() + "/files/mafiaResults/";
            clearOutputDirectory(outputDirectory);
            new File(outputDirectory).mkdirs();
            String host =  "localhost";
            if(useIPAddress){
                host = getIpAddress();
            }
            final TestCaller testCaller = new URLTestCaller(fitNesseRunPort, "http",host,
                    new File(outputDirectory), resultStore);

            final Date startDate = new Date();
            final FitNesseTestRunner runner = new FitNesseTestRunner(testCaller,
                    stopTestsOnIgnore, stopTestsOnException, stopTestsOnWrong, getLog());
            runner.runTests(tests);
            runner.runSuites(suites);
            runner.runFilteredSuite(suitePageName, suiteFilter);
            saveTestSummariesAndWriteProperties(runner.getTestSummaries(), startDate);
            printTestResults(runner.getTestSummaries());
            getLog().info("Finished test run.");
        } catch (MafiaException e) {
            throw new MojoFailureException("Failed to run tests.", e);
        } catch (UnknownHostException e) {
            throw new MojoFailureException("Failed to run tests.", e);
        } catch (SocketException e) {
            throw new MojoFailureException("Failed to run tests.", e);
        } finally {
            if (startServer) {
                stopCommander();
            }
        }
    } else {
        getLog().info("Skipping mafia reporting.");
    }
}

Configuration to include dependencies with scope 'provided' in the content.txt

Hello Gijs,

first of all: I really like and appreciate your plugin.

I'm currently trying to update our mafia plugin version from 1.0.11 to 2.1.5. I recognized that the maven dependencies with the scope 'provided' are no longer included in the generated content.txt. But I need them in order to run my fitnesse tests.
Could you provide a configuration like to include them, please?

Best Regards
Philipp

Bug in Report generation

Hi,

this plugin is great. I can use it for my fitnesse tests without any problems. Thanks for your work.

I've one Issue. I run the tests in the integration test phase. Later in site phase I run report with runTests=false. The MafiaResultCollector then throws an exception because the vm-template files could not be found.

These exception is caused by the VelocityFactory used in line 155 in the MafiaResultCollector. The VelocityFactory is only setup in the FitnesseCommander. And the FitnesseCommander is only used in the RunnerPluginManager.

To solve this problem I've added the following code snippet in the ReporterPluginManager to initialize the VelocityFactory. If the Factory was intialized before, then "makeVelocityFactory" does nothing.

The code is in the try {} block in the run() method of the ReporterPluginManager:

try {
final FitNesseContext context = new FitNesseContext();
context.rootPath = reporterPluginConfig.getWikiRoot();
context.rootDirectoryName = reporterPluginConfig.getNameRootPage();
VelocityFactory.makeVelocityFactory(context);
final MafiaReportGenerator....

Could you please fix this?

Thanks in Advance
Steffen...

How to configure mafia-maven-plugin for existing fitnesse project?

Below is my current project setup.

  • We have a java project written to test the webservices of our project. ( This is the actual fixture code).
  • We have a mavan project created for Fitnesse. ( From here we are testing our actual product by using the fixture code written in the above project. )
  • We are specifying the class files path in the fitnesse pages to refer the fixture code like below.

!path C:\AccFitnesse\AccPlatformService\target\classes

Could you guide me on how can I integrate my existing project with mafia-maven-plugin ?

FitNesse release 20151230 mvn mafia:stop stopps listening on port but does not exit the process

FitNesse release 20150814 mvn mafia:stop works as expected

mvn mafia:start
mvn mafia:stop
mvn mafia:start
mvn mafia:stop

after this sequence no java processes is running (correct)

FitNesse release 20151230 mvn mafia:stop stopps listening on port but does not exit / kill the process

mvn mafia:start
mvn mafia:stop
mvn mafia:start
mvn mafia:stop

after this sequence two java processes are running which is not correct

Tested with

jdk 8
FitNesse release 20151230
mafia-maven-plugin
nl.sijpesteijn.testing.fitnesse.plugins
mafia-maven-plugin
2.1.6

jvmArguments lead to crash

When adding the JVMArguments:


CM_SYSTEM=nl.....cmSystems.SubVersionCmSystem

The java command is not executed correctly. i.e. the arguments are pasted directly after the java command

mafia:start error

mafia:start
[ERROR] Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.12:start (default-cli) on project webcki-fitnesse: Could not run command. Cannot run program "java" (in directory "/home/zgq/git/webcki/webcki-fitnesse"): error=2, have no that file or directory -> [Help 1]

but the directory is exist , please help me! Thanks!

suiteHistoryXML.vm is missing in 1.0.14

Hi Gijs,

i've updated my mafia maven plugin from 1.0.12 to 1.0.14. After mvn clean mafia:start I got the following exception:

SEVERE: ResourceManager : unable to find resource 'suiteHistoryXML.vm' in any resource loader.
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'suiteHistoryXML.vm'
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1380)
at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:401)
at fitnesse.responders.run.formatters.SuiteHistoryFormatter.allTestingComplete(SuiteHistoryFormatter.java:44)
at fitnesse.responders.run.formatters.BaseFormatter.errorOccured(BaseFormatter.java:38)
at fitnesse.responders.run.formatters.CompositeFormatter.errorOccured(CompositeFormatter.java:28)
at fitnesse.responders.run.MultipleTestsRunner.exceptionOccurred(MultipleTestsRunner.java:243)
at fitnesse.responders.run.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:64)
at fitnesse.responders.run.SuiteResponder.performExecution(SuiteResponder.java:47)
at fitnesse.responders.run.TestResponder.doSending(TestResponder.java:45)
at fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:67)
at fitnesse.responders.ChunkingResponder.access$000(ChunkingResponder.java:17)
at fitnesse.responders.ChunkingResponder$RespondingRunnable.run(ChunkingResponder.java:106)
at java.lang.Thread.run(Thread.java:662)

Do I miss something?

Regards
Steffen...

mafia:report produces a Parser Exception: org/apache/maven/doxia/siterenderer/resources/default-site.vm

Hello,

Steps to reproduce the issue:

  1. create an empty maven project
  2. add this pom:
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mygroup</groupId>
    <artifactId>mafiaplayground</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <version.mafia>2.1.5</version.mafia>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>nl.sijpesteijn.testing.fitnesse.plugins</groupId>
                <artifactId>mafia-maven-plugin</artifactId>
                <version>${version.mafia}</version>
            </plugin>
        </plugins>
    </build>
</project>
  1. mvn mafia:content mafia:start
  2. execute the default test http://localhost:9090/FitNesse.UserGuide.TwoMinuteExample?test
  3. mvn mafia:report
    produces the following output:
[INFO] --- mafia-maven-plugin:2.1.5:report (default-cli) @ mafiaplayground ---
[ERROR] Parser Exception: org/apache/maven/doxia/siterenderer/resources/default-site.vm
[ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered "1.0" at line 308, column 51.
Was expecting one of:
    <RPAREN> ...
    <WHITESPACE> ...
    "-" ...
    "+" ...
    "*" ...
    "/" ...
    "%" ...
    <LOGICAL_AND> ...
    <LOGICAL_OR> ...
    <LOGICAL_LT> ...
    <LOGICAL_LE> ...
    <LOGICAL_GT> ...
    <LOGICAL_GE> ...
    <LOGICAL_EQUALS> ...
    <LOGICAL_NOT_EQUALS> ...

    at org.apache.velocity.runtime.parser.Parser.generateParseException(Parser.java:3679)
    at org.apache.velocity.runtime.parser.Parser.jj_consume_token(Parser.java:3558)
    at org.apache.velocity.runtime.parser.Parser.SetDirective(Parser.java:1972)
    at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:369)
    at org.apache.velocity.runtime.parser.Parser.Directive(Parser.java:918)
    at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:379)
    at org.apache.velocity.runtime.parser.Parser.IfStatement(Parser.java:1692)
    at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java:352)
    at org.apache.velocity.runtime.parser.Parser.process(Parser.java:317)
    at org.apache.velocity.runtime.parser.Parser.parse(Parser.java:117)
    at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1226)
    at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1181)
    at org.apache.velocity.Template.process(Template.java:134)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:437)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
    at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.processTemplate(DefaultSiteRenderer.java:533)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.writeTemplate(DefaultSiteRenderer.java:508)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.generateDocument(DefaultSiteRenderer.java:485)
    at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

[ERROR] ResourceManager.getResource() parse exception
[ERROR] org.apache.velocity.exception.ParseErrorException: Encountered "1.0" at org/apache/maven/doxia/siterenderer/resources/default-site.vm[line 308, column 51]
Was expecting one of:
    <RPAREN> ...
    <WHITESPACE> ...
    "-" ...
    "+" ...
    "*" ...
    "/" ...
    "%" ...
    <LOGICAL_AND> ...
    <LOGICAL_OR> ...
    <LOGICAL_LT> ...
    <LOGICAL_LE> ...
    <LOGICAL_GT> ...
    <LOGICAL_GE> ...
    <LOGICAL_EQUALS> ...
    <LOGICAL_NOT_EQUALS> ...

    at org.apache.velocity.Template.process(Template.java:151)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:437)
    at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
    at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
    at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.processTemplate(DefaultSiteRenderer.java:533)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.writeTemplate(DefaultSiteRenderer.java:508)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.generateDocument(DefaultSiteRenderer.java:485)
    at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.894s
[INFO] Finished at: Tue Mar 31 14:55:08 CEST 2015
[INFO] Final Memory: 13M/491M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal nl.sijpesteijn.testing.fitnesse.plugins:mafia-maven-plugin:2.1.5:report (default-cli) on project mafiaplayground: An error has occurred in FitNesse test results report generation. Could not find the template 'org/apache/maven/doxia/siterenderer/resources/default-site.vm -> [Help 1]

It seems to me that the included doxia version version (1.0) contains an invalid velocity template.

Not sure, if this is really a bug, but it seems to be.

Best Regards
Philipp

support to specify output format

the mafia plugin uses ?suite to get the suite results, is it possible to provide an option to specify the format type like ?suite&format=xml

Variables definition - mvn mafia:content - !path but not !define

Hello, I have an issue with the point 4 CLASSPATH ENTRIES & DEFINITIONS.

In the documentation I can see:

Property Default Description
resources Values are prefixed with !define and copied to content.txt

In my pom.xml I point to a file using a environment variable:

<resources>
    <resource>${project.basedir}/src/main/resources/environments/content-${test.env}.txt</resource>
</resources>

in the resources file I set properties depending the environment, src\main\resources\environments\content-hdp-fut1.txt

!define BASE_URL {blablabla}
!define ES_CLUSTER {blablabla}
!define ES_CLUSTER_NAME {blablabla}

in the content.txt file an import !path has been created but not the variables prefixed by !define.

!note Resources:
!path (the path of my file)/content-hdp-fut1.txt

Is it the expected behavior? Do you have any way to set dynamically !define variables?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.