How to setup multiple fitnesse suites in pom file

2019-07-23 04:27发布

问题:

I am able to run the FitNesse suite from maven build with the following setup.

<properties>
    <fitnesse.version>20160618</fitnesse.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.fitnesse</groupId>
        <artifactId>fitnesse</artifactId>
        <version>${fitnesse.version}</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.fitnesse.plugins</groupId>
        <artifactId>maven-classpath-plugin</artifactId>
        <version>1.6</version>
        <scope>runtime</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>start-fitnesse-integration</id>
                    <phase>integration-test</phase>
                    <configuration>
                        <tasks>
                            <echo taskname="fitnesse" message="Starting FitNesse..." />
                            <java classname="fitnesseMain.FitNesseMain" classpathref="maven.runtime.classpath"
                                fork="true" failonerror="true">
                                <jvmarg value="-Xmx1024m" />
                                <arg line="-p 9000" />
                                <arg line="-c FrontPage.TestSuite?suite&amp;amp;format=text" />
                                <arg line="-e 0" />
                                <!-- <arg line="-d ." /> -->
                            </java>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I am running the FitNesse suite using the below command.

mvn clean install

Now I want to configure execution of multiple FitNesse suites as part of pom.xml and want to run specific suite as part of maven build.

How can I achieve this?

回答1:

There are a couple of ways to configure multiple suites to be run:

  • Add multiple execution elements to your pom (inside the executions element you already have) one per suite, each with a unique id
  • Place all suites you want to run under a shared parent suite (and run the parent suite). You can also use symbolic links to achieve this.
  • Create a suite query page to indicate which suites should be run (and run that page).
  • Create a suite cross reference page and run that
  • Give all suites the same tag and use filters to select all suites to run based on the tag

P.S. Why are you using the antrun plugin instead of maven-exec?