接口自动化测试持续集成--Soapui接口功能测试持续集成

Soapui接口功能测试持续集成,需要先安装好maven和jenkins,maven和jenkins安装和系统环境配置比较简单,在这里不做叙述。


 

1.Soapui保存的工程文件

soapui工程保存之后会生成一个工程的xml文件,这个文件就是用来跟maven集成的


 

2.Maven的pom文件管理saopui的工程文件

下面的代码即为maven pom.xml文件的配置

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.smrt.webService</groupId>
  <artifactId>soapui-maven2-plugin</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>webService Integration Test</name>
  <url>http://maven.apache.org</url>
  <pluginRepositories>
    <pluginRepository>
      <id>SmartBearPluginRepository</id>
      <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <plugins>
      <plugin>
        <groupId>com.smartbear.soapui</groupId>
        <artifactId>soapui-pro-maven-plugin</artifactId>
        <version>5.1.1</version>
        <!-- soapui做持续集成需要的maven依赖 -->
        <dependencies>
          <dependency>
            <groupId> org.reflections</groupId>
            <artifactId> reflections</artifactId>
            <version> 0.9.9-RC1</version>
          </dependency>
          <dependency>
            <groupId> org.apache.poi</groupId>
            <artifactId> poi-ooxml</artifactId>
            <version> 3.10-FINAL</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <!-- soapui的工程文件 -->
              <projectFile>soapui_crm.xml</projectFile>
              <!-- 所有的testSuite -->
              <testSuite>*</testSuite>
              <!-- 输出报告的格式为junit格式 -->
              <junitReport>true</junitReport>
              <!-- 输出报告的格式为junit格式 -->
              <outputFolder>./report</outputFolder>
              <printReport>true</printReport>
              <projectProperties>
                <value>message=delete customer for eclite autotest!</value>
              </projectProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>.</directory>
              <includes>
                <include>**/*.log</include>
              </includes>
            </fileset>
            <fileset>
              <directory>./report</directory>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

3.把pom.xml文件和soapUI项目工程文件“soapui_crm.xml”放在同一路径下

4.pom.xml文件的路径下执行mvn test

这个时候会下载mvn的所有依赖,依赖下载完毕会执行所有的testSuite


 

5.jenkins配置job

  • 设置工作空间
  • 调用mvn指令
 
image.png
  • 发布测试报告
 
image.png
  • 发送邮件相关同时
 

6.生成测试结果报告

原文地址:https://www.cnblogs.com/lingqiang0605/p/10216558.html