如何让soapUI Maven 插件故障安全?

发布于 2024-11-29 10:47:47 字数 2262 浏览 5 评论 0原文

AFAIK,maven 故障安全插件故障安全,因为它具有运行测试和基于测试失败构建的单独目标。它们被设计为分别与集成测试和验证目标绑定。这允许集成测试后绑定目标在构建失败之前运行(关闭构建)。

我的问题是,如何使用 maven-soapui-plugin 执行此操作?我想我可以简单地在我的soapui插件配置中指定true,然后调用failsafe插件验证目标,但这不起作用。我不认为我不确定我是否从soapui插件中获取了摘要文件。我不断收到 Expected root element 'failsafe-summary' butfound 'testsuite' 这是 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>
</plugin>

我的 POM 是否有问题,或者这是一个不好的方法?还有更好的方法吗?

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>
</plugin>

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

帝王念 2024-12-06 10:47:47

Soapui 插件有一个开源扩展,它有一个专门用于此目的的单独的测试验证目标。

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

以下示例显示了所需的配置:
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/master/src/it/test-verify_goal/one_failing_project/pom.xml

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

今天小雨转甜 2024-12-06 10:47:47

AFAIK maven-failsafe-plugin 只能验证 maven-failsafe-plugin 运行的测试的成功状态,而不能验证 maven-soapui-plugin 运行的测试的成功状态。它通过读取具有特定格式的测试摘要报告文件(failsafe-summary.xml)来实现这一点。

maven-soapui-plugin 可以调整为将运行测试与验证测试成功状态分开,以支持在验证之前运行集成后测试任务(停止服务器、取消部署工件等)。为soapUI人员创建支持票

也许甚至可以扩展 maven-failsafe-plugin(它的验证魔力)以允许指定不同的测试报告格式(JUnit 风格的报告由soapUI支持,甚至是maven-failsafe-plugin使用的xpath表达式来确定是否有失败的测试。在 maven-failsafe-plugin 问题跟踪器< 上为此创建支持票证/a>.

在支持这些扩展之前,并且您需要在集成后测试阶段执行任务,您可以使用 soapUI JUnit 集成 并让 maven-failsafe-plugin 运行这些soapUI JUnit 测试。

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.

木落 2024-12-06 10:47:47

我正在尝试这个解决方案,但它不起作用。
但我找到了一个。
为了在 Jenkins 中获取 SOAPUI 测试的测试报告,我在 Soap 测试文件夹的 pom.xml 中使用带有此配置的故障安全插件:

<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>

测试用例状态由 Jenkins 决定。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文