Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Running Maven with SOAtest

Options
Billy McMullin
Billy McMullin Posts: 64 admin

Parasoft offers a Maven integration plugin that will allow you to execute SOAtest analysis on project with Maven. Please follow the steps below if you would like to have SOAtest execute during your Maven process:

  1. Before you can use the Parasoft Test Maven plugin, you need to add the "http://build.parasoft.com/maven" repository to your POM or repository manager. For instance:

    <project> ... <pluginRepositories> <pluginRepository> <id>Parasoft</id> <url>http://build.parasoft.com/maven</url> </pluginRepository> </pluginRepositories> ... </project>

  2. Once added, you can choose do one of the following to execute Parasoft with:

Extend the POM, Configure the plugin through the command line, or configure a Profile Switch.

Extending the POM
1). If you extend the POM, the specified goals will always be run at a particular phase of the build lifecycle. This allows you to specify your configuration once, and have it used every time that Maven builds the configured project. First, specify the plugin version. For example:

 <project>
    ...
    <build>
    <!-- To define the plugin version in your parent POM -->
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>Parasoft</groupId>
                    <artifactId>maven-parasoft-plugin</artifactId>
                    <version>3.0</version>
                </plugin>
                ...
            </plugins>
        </pluginManagement>
        <!-- To use the plugin goals in your POM or parent POM -->
        <plugins>
            <plugin>
                <groupId>Parasoft</groupId>
                <artifactId>maven-parasoft-plugin</artifactId>
                <version>3.0</version>
            </plugin>
            ...
        </plugins>
    </build>
    ...
</project>

2). Next, specify goals and configuration parameters. For example:

<project>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>Parasoft</groupId>
                <artifactId>maven-parasoft-plugin</artifactId>
                <executions>
                    <execution>
                        <id>soatest-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>soatest</goal>
                        </goals>
                        <configuration>
                            <clean>false</clean>
                            <config>soatest.builtin://Demo Configuration</config>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    ... 
</project>

3). Once added to your POM, you can execute the project with the following command line:

mvn clean test -Dparasoft.soatest.home="PATH TO SOATEST INSTALL" -Dparasoft.localsettings="PATH TO LOCALSETTINGS FILE"

Configure from the Command line
1). The most direct way to execute the plugin is to configure the plugin execution details completely from the command line. For example:

Parasoft:maven-parasoft-plugin:soatest -Dparasoft.config="builtin://Demo Configuration" -Dparasoft.soatest.home="PATH TO SOATEST INSTALL" -Dparasoft.localsettings="PATH TO LOCALSETTINGS FILE"

Configuring a Profile Switch
1). You can add a Profile Switch to the POM so you can run the appropriate switch when you want to apply one of the Parasoft goals. You can configure any number of switches with different goals and parameters. This approach is useful when you want to set plugin execution details in the POM but don't want it permanently attached to a lifecycle phase. You can create a profile switch like the following:
<project> ... <profiles> <profile> <id>soatest</id> <build> <plugins> <plugin> <groupId>Parasoft</groupId> <artifactId>maven-parasoft-plugin</artifactId> <configuration> <config>soatest.builtin://Demo Configuration</config> </configuration> <executions> <execution> <phase>test</phase> <goals> <goal>soatest</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> ... </project>

2). You can then use "mvn clean install -Psoatest" and this will run the soatest profile.

NOTE:
In order to execute SOAtest, you need to have a ".project" file that works in the server environment.

You can find an example POM.xml using the Extended POM method attached to this post.

Comments