【发布时间】:2016-08-31 12:36:24
【问题描述】:
可以像这样在 SOAP UI 中为测试用例指定标签:
我正在使用 SOAP UI Maven 插件在不同的环境中执行功能测试套件,如果能够通过在调用中指定标签来排除某些测试用例,将会很有用。
Maven 插件似乎没有配置参数来指定标签(因此只能执行跨跨不同测试套件的测试子集):
https://www.soapui.org/test-automation/maven/maven-2-x.html
但是,通过 GUI 或命令行运行时可以指定标签:
http://readyapi.smartbear.com/features/automation/testrunner/cli
您可以从上面的链接中看到,可以指定使用 -T 开关标记的测试。
这只是 Maven 插件的限制吗?
是否可以通过在 Groovy 启动脚本执行期间读取环境变量并禁用没有指定标签的测试用例来模拟指定标签?
Maven调用如下:
mvn test -Dmyenv="dev" com.smartbear.soapui:soapui-pro-maven-plugin:5.2.1:test
pom.xml 如下所示:
<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>testing</groupId>
<artifactId>testing</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
<pluginRepository>
<id>mvnPluginRepository</id>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven/mule/dependencies/maven2/</url>
</pluginRepository>
<pluginRepository>
<id>codehausPluginRepository</id>
<url>https://nexus.codehaus.org/content/groups/snapshots-group/org/codehaus/mojo/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>5.2.1</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections-maven</artifactId>
<version>0.9.9-RC1</version>
</dependency>
</dependencies>
<configuration>
<projectFile>${basedir}/my-project</projectFile>
<outputFolder>${basedir}/surefire-reports</outputFolder>
<printReport>true</printReport>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<reportFormat>HTML</reportFormat>
<testFailIgnore>true</testFailIgnore>
<coverage>true</coverage>
<environment>${myenv}</environment>
</configuration>
<executions>
<execution>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
【问题讨论】:
-
不知道你在追求什么。像这样的东西:siking.wordpress.com/2014/01/29/… ?
标签: java maven automated-tests soapui