开始单个测试很简单,之后的多个测试自动化颇花费我几天研究。以下两个链接有一定帮助。
http://appletest.lofter.com/post/1d595918_7f8880b
http://forum.loadui.org/viewtopic.php?f=14&t=5381&sid=287d90541a28f9243a7010fb683173f5
最终是用一个parent pom 以及多个child pom解决。(maven 的 profile)
Parent pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pbs.tno.ci.test</groupId>
<artifactId>master</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Automated Testing Master</name>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<properties>
<soapui.rootdir>/../SOAPUI</soapui.rootdir>
</properties>
<profiles>
<profile>
<id>test</id>
<properties>
</properties>
<modules>
<module>Tests/SimpleTest/TestCase1</module>
</modules>
</profile>
<profile>
<id>notification_agent</id>
<modules>
<module>Tests/NotificationAgent/TestCase1</module>
</modules>
</profile>
<profile>
<id>qc_service</id>
<modules>
<module>Tests/QCService/TestCase1</module>
</modules>
</profile>
<profile>
<id>transfer_service</id>
<modules>
<module>Tests/TransferService/TestCase1</module>
</modules>
</profile>
</profiles>
</project>
Child pom:
<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>
<parent>
<groupId>org.pbs.tno.ci.test</groupId>
<artifactId>master</artifactId>
<version>1.0</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<artifactId>TransferService</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>testmaven2</name>
<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.2</version>
<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>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<executions>
<execution>
<id>soapUI1</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>/Feng/Maven SoapUI test projects/Build/Tests/TransferService/TestCase1/TransferService-soapui-project.xml</projectFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
如果想同时run 这两个test,输入:
mvn test -Ptransfer_service -Ptest
如果用的是Ready API,千万要注意也得用Ready API Maven Plugin, 而不是SoapUI pro maven plugin! 血泪教训,花了整整两天才发现错误出自这!。
如果想同时run 这两个test,输入:
mvn test -Ptransfer_service -Ptest
如果用的是Ready API,千万要注意也得用Ready API Maven Plugin, 而不是SoapUI pro maven plugin! 血泪教训,花了整整两天才发现错误出自这!。
没有评论:
发表评论