2011-08-12 95 views
0

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

我的问题是,我怎么用maven-soapui-plugin来做到这一点?我想我可以简单地在我的soapui插件配置中指定<testFailIgnore>true</testFailIgnore>,然后调用failsafe插件验证目标,但那不起作用。我不认为我不确定我是否从soapui插件中获取摘要文件。我不断收到Expected root element 'failsafe-summary' but found '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或者这是一个不错的办法?有没有更好的方法?

回答

1

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

可以调整maven-soapui-plugin以将运行测试与验证测试成功状态分开,以支持在验证之前运行集成后测试任务(停止服务器,取消部署工件等)。创建一个support ticket for this to soapUI guys

也许甚至可以通过maven-failsafe插件验证mojo,以允许指定不同的测试报告格式(JUnit style reports are supported by soapUI),甚至可以使用maven-failsafe插件使用的xpath表达式来确定是否失败测试与否。在maven-failsafe-plugin issue tracker上为此创建支持票。

直到支持这些扩展,并且您需要在后整合测试阶段完成任务后,您可以使用soapUI JUnit integration并让maven-failsafe插件运行这些soapUI JUnit测试。

+0

这个答案是最好的,当我问的问题,但改变公认的答案马克霍华德的,因为这是一个更好的解决方案,已自那时以来发展。谢谢。 – Jared

1

我正在尝试此解决方案,但它不起作用。 但我找到了。 为了获得SOAPUI测试去测试报告詹金斯,我使用故障安全插件,在我的肥皂测试文件夹的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> 

的测试用例状态均达到詹金斯。

+1

因此,您发布的答案,你知道不起作用?这有什么帮助? – Jared