Skip to content

How to run tests for test suites with SoapUI

dstenger edited this page May 24, 2019 · 12 revisions

Create SoapUI test suite

Create SoapUI project file for target test suite and push it to src/test/resources/soapui/[TEST_SUITE_ID]-soapui-project.xml.

Hints:

  • All custom configuration variables should be defined on project level. Otherwise, Maven cannot modify them.
  • Use custom configuration variables which are described below.

Also, create a SoapUI settings file and push it to src/test/resources/soapui/[TEST_SUITE_ID]-soapui-settings.xml.

Content of SoapUI settings file shall be:

<con:soapui-settings xmlns:con="http://eviware.com/soapui/config">
   <con:setting id="HttpSettings@socket_timeout">300000</con:setting>
</con:soapui-settings>

System tests

Update Maven configuration

Add following to pom.xml.

...
  <properties>
    <soapui.test.fail.ignore>false</soapui.test.fail.ignore>
    <soapui.teamengine.endpoint>[ADD_CONTENT]</soapui.teamengine.endpoint>
    <soapui.iut>[ADD_CONTENT]</soapui.iut>
    <soapui.tests.passed>[ADD_CONTENT]</soapui.tests.passed>
    <soapui.tests.skipped>[ADD_CONTENT]</soapui.tests.skipped>
    <soapui.tests.failed>[ADD_CONTENT]</soapui.tests.failed>
  </properties>
...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.smartbear.soapui</groupId>
          <artifactId>soapui-maven-plugin</artifactId>
          <version>5.5.0</version>
          <dependencies>
            <dependency>
              <groupId>com.jgoodies</groupId>
              <artifactId>forms</artifactId>
              <version>1.0.7</version>
            </dependency>
          </dependencies>
          <configuration>
            <projectFile>src/test/resources/soapui/[TEST_SUITE_ID]-soapui-project.xml</projectFile>
            <settingsFile>src/test/resources/soapui/[TEST_SUITE_ID]-soapui-settings.xml</settingsFile>
            <outputFolder>${project.build.directory}/soapui</outputFolder>
            <junitReport>true</junitReport>
            <testFailIgnore>${soapui.test.fail.ignore}</testFailIgnore>
            <projectProperties>
              <value>teamengine.endpoint=${soapui.teamengine.endpoint}</value>
              <value>iut=${soapui.iut}</value>
              <value>tests.passed=${soapui.tests.passed}</value>
              <value>tests.skipped=${soapui.tests.skipped}</value>
              <value>tests.failed=${soapui.tests.failed}</value>
            </projectProperties>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
...
  <pluginRepositories>
    <pluginRepository>
      <id>smartbear-sweden-plugin-repository</id>
      <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
  </pluginRepositories>
...

Caution: All place holders ([...]) must be replaced.

Create Jenkinsfile

Create Jenkinsfile with path jenkinsfiles/test/Jenkinsfile and add following content.

pipeline {
  agent any
  tools {
    maven 'mvn'
    jdk 'JDK 8'
  }
  stages {
    stage('Preparation') {
      steps{
        deleteDir()
        sh 'git clone git@github.com:opengeospatial/[TEST_SUITE_ID].git .'
      }
    }
    stage('Test') {
      steps{
        sh 'mvn --version'
        sh 'mvn clean com.smartbear.soapui:soapui-maven-plugin:test -Dsoapui.test.fail.ignore=true -Dsoapui.teamengine.endpoint=${teamengineEndpoint} -Dsoapui.iut=${iut} -Dsoapui.tests.passed=${testsPassed} -Dsoapui.tests.skipped=${testsSkipped} -Dsoapui.tests.failed=${testsFailed}'
      }
    }
    stage('Results') {
      steps{
        junit '**/target/soapui/TEST-*.xml'
        archive 'target/*'
      }
    }
  }
}

Caution: All place holders ([...]) must be replaced.

Now, SoapUI tests can be executed with any Jenkins instance by using the Jenkinsfile.

Run system tests

Requirements

  • Maven, Java and Git must be installed.
  • Target test suite must be cloned.

Run tests manually

Command (executed in main directory of target test suite):

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

Hints:

  • SoapUI related properties defined in Maven POM are used to configure test execution. They may be changed to create a different test set up.

Integration tests

Preconditions

During integration-test Maven phase a running instance of target test suite must be available via REST interface.

This can be accomplished by using Docker. Following configuration must be done: How to create Docker Images of test suites

In addition, configuration of system tests must be done as described in previous chapter.

Update Maven configuration

Add following to pom.xml.

...
  <properties>
    <soapui.teamengine.endpoint>http://localhost:8081/teamengine</soapui.teamengine.endpoint>
    <soapui.iut>[ADD_CONTENT]</soapui.iut>
    <soapui.tests.passed>[ADD_CONTENT]</soapui.tests.passed>
    <soapui.tests.skipped>[ADD_CONTENT]</soapui.tests.skipped>
    <soapui.tests.failed>[ADD_CONTENT]</soapui.tests.failed>
  </properties>
...
  <profiles>
    <profile>
      <id>integration-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>start</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>build</goal>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>copy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

Caution: All place holders ([...]) must be replaced.

Create or update Jenkinsfile

Create or update Jenkinsfile with path jenkinsfiles/build/Jenkinsfile and add following content.

pipeline {
  agent any
  tools {
    maven 'mvn'
    jdk 'JDK 8'
  }
  stages {
    stage('Preparation') {
      steps{
        deleteDir()
        sh 'git clone git@github.com:opengeospatial/[TEST_SUITE_ID].git .'
      }
    }
    stage('Build') {
      steps{
        sh 'mvn --version'
        sh 'mvn clean install site -Pintegration-tests,docker -Dsoapui.test.fail.ignore=true'
      }
    }
    stage('Results') {
      steps{
        junit '**/target/surefire-reports/TEST-*.xml'
        junit '**/target/soapui/TEST-*.xml'
        archive 'target/*'
      }
    }
  }
}

Caution: All place holders ([...]) must be replaced.

Now, SoapUI tests can be executed with any Jenkins instance by using the Jenkinsfile.

Run integration tests

Requirements

  • Maven, Java and Git must be installed.
  • Docker must be installed and must be executable by user running the build.
  • Target test suite must be cloned.

Run tests manually

Command (executed in main directory of target test suite):

mvn clean verify -Pintegration-tests

Hints:

  • SoapUI related properties defined in Maven POM are used to configure test execution. Please adjust soapui.iut, soapui.tests.passed, soapui.tests.skipped and soapui.tests.failed to correct values.
You can’t perform that action at this time.