Maven

Maven

 maven

SoapUI includes a Maven (version 2 and above) plugin for running SoapUI tests and mocks during a Maven build. So, in the examples below, we’re using the 4.6.1 version of the plugins. Please see our public SoapUI Open Source and SoapUI Pro Maven repositories for which versions that are currently available.

Prior to using the plugin, add the SmartBear Maven 2 repository either to your project or settings.xml:

<pluginRepositories>

<pluginRepository>

<id>smartbear-sweden-plugin-repository</id>

<url>http://www.soapui.org/repository/maven2/</url>

</pluginRepository>

</pluginRepositories>

 

After this, add the SoapUI plugin to pom.xml:

<plugins>

<plugin>

<groupId>com.smartbear.soapui</groupId>

<artifactId>soapui-maven-plugin</artifactId>

<version>4.6.1</version>

<configuration>

<projectFile>simple-test-soapui-project.xml</projectFile>

<projectProperties>

<value>message=Hello World!</value>

</projectProperties>

</configuration>

</plugin>

</plugins

Running Tests

Run functional tests with, command

mvn com.smartbear.soapui:soapui-maven-plugin:4.6.1:test

 

loadtests with, command

mvn com.smartbear.soapui:soapui-maven-plugin:4.6.1:loadtest

 

and MockServices with, command

mvn com.smartbear.soapui:soapui-maven-plugin:4.6.1:mock

 

The plugin will load the specified project file and run all TestCases available in all TestSuites. However, if you want to narrow down which TestSuites/TestCases/LoadTest to run. So, use the testSuite, testCase and loadTest properties for that purpose.

Integrated Tools

If you configure any of the integrated code generation tools in SoapUI for an interface in your project. Certainly, you can invoke this code generation functionality with

mvn com.smartbear.soapui:soapui-maven-plugin:4.6.1:tool

 

which could be configured in the Maven 2 build process as part of the generate-sources step:

 

<plugins>

<plugin>

<groupId>com.smartbear.soapui</groupId>

<artifactId>soapui-maven-plugin</artifactId>

<version>4.6.1</version>

<configuration>

<projectFile>sample-soapui-project.xml</projectFile>

<testSuite>OleTest</testSuite>

<iface>IOrderService</iface>

<tool>wsi,axis1,axis2</tool>

<settingsFile>C:\workspace\core\soapui-settings.xml</settingsFile>

</configuration>

<executions>

<execution>

<phase>generate-sources</phase>

<goals>

<goal>generate</goal>

</goals>

</execution>

</executions>

</plugin>

</plugins>

 

Several tools can be specified in a comma-separated list.  So, the above example would run both WS-I reports and configured code generation for both Axis1 and Axis2. Moreover, the SoapUI settings file has been specified since it contains tool paths and global WS-I settings

Plugin Goals

  • Firstly, test : Runs the SoapUI tests as specified by the plugin properties. Internally invokes the SoapUITestCaseRunner class as described there.
  • Secondly, loadtest : Runs the SoapUI loadtests as specified by the plugin properties. Internally invokes the SoapUILoadTestRunner class as described there.
  • Subsequently, tool : Runs the specified and configured code-generation tool. Internally invokes the SoapUIToolRunner class as described there.
  • Lastly, mock : Runs the specified and configured code-generation tool. Internally invokes the SoapUIMockServiceRunner class as described there.

Plugin Settings

test settings

  • First of all, projectFile : Specified the name of the SoapUI project file to use, default value is ${pom.artifactId}-soapui-project.xml.
  • Secondly, testSuite : Specifies the name of the TestSuite to run.
  • Thirdly, testCase : Specifies the name of the TestCase to run.
  • Subsequently, endpoint : Overrides the service endpoint to be invoked by any TestRequests.
  • Further, host : Overrides the target host:port to be invoked by any TestRequests.
  • In addition, username : Overrides the username used by any TestRequests run.
  • Moreover, password : Overrides the password used by any TestRequests run.
  • After this, domain : Overrides the domain used by any TestRequests run.
  • Not to mention, printReport : Controls if a small test report should be printed to the console (true/false).
  • After this, outputFolder : Set which folder results/reports are saved to.
  • Moreover, junitReport : Turns on creation of JUnit-reports, (true/false).
  • Subsequently, exportAll : Controls if all test requests should be exported (default only exports errors), (true/false).
  • Lastly, settingsFile : Specifies SoapUI settings file to use.

 

loadtest settings

  • First of all, projectFile : Specified the name of the SoapUI project file to use, default value is ${pom.artifactId}-soapui-project.xml.
  • Secondly, testSuite : Specifies the name of the TestSuite to run.
  • Thirdly, testCase : Specifies the name of the TestCase to run.
  • Subsequently, loadTest : Specifies the name of the LoadTest to run (if running the soapui:loadtest goal).
  • Further, limit : Overrides the limit of executed LoadTests (if running the soapui:loadtest goal).
  • After this, endpoint : Overrides the service endpoint to be invoked by any TestRequests.
  • Moreover, host : Overrides the target host:port to be invoked by any TestRequests.
  • In addition, username : Overrides the username used by any TestRequests run.
  • Subsequently, password : Overrides the password used by any TestRequests run.
  • After this, domain : Overrides the domain used by any TestRequests run.
  • Further, printReport : Controls if a small test report should be printed to the console (true/false).
  • Lastly, outputFolder : Set which folder results/reports are saved to.

 

tool settings

  • First thing first, projectFile : Specified the name of the SoapUI project file to use, default value is ${pom.artifactId}-soapui-project.xml.
  • Secondly, iface : Specifies the interface to generate for.
  • Thirdly, tool : Specifies the tool(s) to run, a comma-separated list of axis1, axis2, dotnet, gsoap, jaxb, wstools, wsconsume, ora, wscompile, wsi, wsimport, xfire or xmlbeans.
  • Subsequently, settingsFile : Specifies SoapUI settings file to use, will contain path to integrated tool to run.
  • Further, password : Specifies password for encrypted project file.
  • Moreover, password : Specifies password for encrypted soapui settings file.
  • Last but not least, outputFolder : Set which folder results/reports are saved.

 

Example

The example below is a complete pom for configuring the Maven 2 plugin, please note

  • On one hand, the jdbc-driver dependency required for JDBC Testing in the project.
  • On the other hand, the project-property override.

 

<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>com.smartbear.samples</groupId>

<artifactId>soapui-maven2-plugin</artifactId>

<packaging>jar</packaging>

<version>1.0-SNAPSHOT</version>

<name>Maven 2 SoapUI Sample</name>

<url>http://maven.apache.org</url>

<pluginRepositories>

<pluginRepository>

<id>SmartBearPluginRepository</id>

<url>http://www.soapui.org/repository/maven2/</url>

</pluginRepository>

</pluginRepositories>

<build>

<plugins>

<plugin>

<groupId>com.smartbear.soapui</groupId>

<artifactId>soapui-pro-maven-plugin</artifactId>

<version>4.6.1</version>

<dependencies>

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>5.1.6</version>

</dependency>

</dependencies>

<executions>

<execution>

<phase>test</phase>

<goals>

<goal>test</goal>

</goals>

<configuration>

<projectFile>simple-test-soapui-project.xml</projectFile>

<projectProperties>

<value>message=Hello World!</value>

</projectProperties>

</configuration>

</execution>

</executions>

</plugin>

</plugins>

</build>

</project>

Make your resume stand out and become a Certified SoapUI Testing Professional. Try free practice tests here!

A great career is just a certification away. So, practice and validate your skills to become Certified SoapUI Testing Professional.

Get industry recognized certification – Contact us

Menu