image.png
大家看到這個老頭,這不是Jenkins嗎毕泌?沒錯這就是jenkins喝检,soapui的持續(xù)集成同樣用Jenkins,我們還會用到maven撼泛,前提是大家要把jenkins與maven的環(huán)境搭建好挠说。
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做持續(xù)集成需要的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文件的路徑下執(zhí)行mvn test
這個時候會下載mvn的所有依賴坎弯,依賴下載完畢會執(zhí)行所有的testSuite
image.png
4.jenkins配置job
-
調用mvn指令
image.png
-
發(fā)布測試報告
image.png
-
發(fā)送郵件相關同時
image.png
-
Jenkins構建
jenkins構建之后我們將會看到如下的測試結果圖在Jenkins上
image.png