开发者

How do you get the soapUI maven plugin to fail safe?

开发者 https://www.devze.com 2023-03-28 06:19 出处:网络
AFAIK, the maven failsafe plugin fails safe because it has separate goals for running the tests and failing the build based on the tests.These are designed to be bound to the integration-test and veri

AFAIK, the maven failsafe plugin fails safe because it has separate goals for running the tests and failing the build based on the tests. These are designed to be bound to the integration-test and verify goals respectively. This allows post-integration-test bound goals to run (shutting down the build) before the build fails.

My question is, how do I do this with the maven-soapui-plugin? I thought I could simply specify <testFailIgnore>true</testFailIgnore> in my soapui plugin config and then call the failsafe plugin verify goal, but that isn't working. I don't think I'm not sure if I'm getting a summary file out of the soapui plugin or not. I keep getting Expected root element 'failsafe-summary' but found 'testsuite' Here is a snippet of the POM:

<plugin>
    <groupId>eviware</groupId>
    <artifactId>maven-soapui-plugin</artifactId>
    <version>4.0.0</version>
    <configuration>
        <junitReport>true</junitReport>
        <exportAll>true</exportAll>
        <outputFolder>${project.build.directory}/surefire-reports</outputFolder>
        <testFailIgnore>true</testFailIgnore>
        <printReport>true</printReport>
    </configuration>
    <executions>
        <execution>
            <id>FailingTest</id>
            <phase>integration-test</phase>
            <goals>
                <goal>test</goal>
            </goals>
            <configuration>
                <projectFile>${basedir}/testData/soapui-integration-tests.xml</projectFile>
                <host>localhost</host>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.9</version>
    <executions>
          <execution>
           <phase>verify</phase>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
            <configuration>
              <summaryFiles>
                <summaryFile>${project.build.directory}/surefire-reports/TEST-TestSuite_1.xml</summaryFile>
              </summaryFiles>
            </configuration>
        </execution>
    </executions>
</plug开发者_Python百科in>

Is there something wrong with my POM or is this a bad approach? Are there any better approaches?


There is an open source extension of the soapui plugin which has a separate test-verify goal for exactly this purpose.

https://github.com/redfish4ktc/maven-soapui-extension-plugin

The following example shows the required configuration: https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/master/src/it/test-verify_goal/one_failing_project/pom.xml


AFAIK maven-failsafe-plugin can only verify success status of tests run by maven-failsafe-plugin and not by maven-soapui-plugin. It does that by reading test summary report file (failsafe-summary.xml) which has specific format.

maven-soapui-plugin could be adjusted to separate running tests from verifying test success status, to support running post-integration-test tasks (stop server, undeploy artifacts, etc.) before verification. Create a support ticket for this to soapUI guys.

Maybe even maven-failsafe-plugin, it's verify mojo, could be extended to allow specifying different test report format (JUnit style reports are supported by soapUI) or even an xpath expression which would be used by maven-failsafe-plugin to determine if there were failed tests or not. Create a support ticket for this on maven-failsafe-plugin issue tracker.

Until those extensions are supported, and you need to do tasks on post-integration-test phase you can use soapUI JUnit integration and have maven-failsafe-plugin run those soapUI JUnit tests.


I am trying this solution, and it doesn't work. But I have found one. To obtain de tests report of SOAPUI tests in Jenkins, I using the failsafe plugin with this configuration in the pom.xml of my Soap tests folder :

<build>
    <plugins>
        <plugin>
            <groupId>eviware</groupId>
            <artifactId>maven-soapui-plugin</artifactId>
            <version>2.6.1</version>
            <configuration>
                <projectFile>${basedir}/soap_project_tests.xml</projectFile>
                <outputFolder>${filePath.reports.soap}</outputFolder>
                <testFailIgnore>true</testFailIgnore>
                <junitReport>true</junitReport>
                <exportwAll>true</exportwAll>
                <printReport>true</printReport>
            </configuration>
            <executions>
                <execution>
                    <id>run-soap-integration-test</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.11</version>
            <configuration>
                <reportsDirectory>${filePath.reports.soap}</reportsDirectory>
                <printSummary>true</printSummary>
                <argLine>-Xmx512m</argLine>
            </configuration>
            <executions>
                <execution>
                    <id>soap-integration-test-verify</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

The tests cases status are up to Jenkins.

0

精彩评论

暂无评论...
验证码 换一张
取 消