Oct 09

The Problem
The project structuring of SoapUI (not the Pro version) is limited. When you use the maven-soapui-plugin to automate your tests, you will define multiple plugins – each pointing to a different project file. Your pom.xml will be messed up with sequences like these:

          <plugin>
            <groupId>eviware</groupId>
            <artifactId>maven-soapui-plugin</artifactId>
            <version>${soapui.version}</version>
            <executions>
              <execution>
                <id>soapui-test-xy</id>
                <phase>test</phase>
                <configuration>
                  <projectFile>${basedir}/src/test/soapui/bkr.xml</projectFile>
                  <outputFolder>${project.build.directory}/soapui</outputFolder>
                  <exportAll>true</exportAll>
                  <printReport>true</printReport>
                  <host>localhost</host>
                </configuration>
                <goals>
                  <goal>test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

The Solution
The solution is very simple. Instead of executing your functional tests with maven just run them from your unit testing framework:

  @Test
  public void test_bkr() throws Exception {
    SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
    runner.setHost("my-host");
    runner.setProjectFile("./src/test/soapui/bkr.xml");
    SoapUiConfigLogger.logConfig(runner);
    runner.run();
  }

Now you have full flexibility of how to organize your tests:

  • package structure
  • test-class name
  • test-method name
  • test-groups (TestNG)
  • ..

I want to test external services that are already running. If you want to test your own services you have to start-up and tear-down jetty. Either you try to use @Before.. and @After.. annotations or you bind your tests to maven’s integration-test and use pre-integration and post-integration for that.

Tagged with:
preload preload preload