Soapui接口功能测试持续集成

2017-06-11  本文已影响0人  御剑逍遥
image.png

大家看到这个老头,这不是Jenkins吗?没错这就是jenkins,soapui的持续集成同样用Jenkins,我们还会用到maven,前提是大家要把jenkins与maven的环境搭建好。


image.png

1.Soapui保存的工程文件

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


image.png

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>*****-workspace.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文件的路径下执行mvn test

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


image.png

4.jenkins配置job

image.png image.png image.png

jenkins构建之后我们将会看到如下的测试结果图在Jenkins上


image.png
谢谢大家关注,有问题也可以在简书上留言,我会尽快回复大家
上一篇 下一篇

猜你喜欢

热点阅读