2016-05-05 11 views
0

を使用してテストケースのためのタグを指定するには、このようなSOAP UIのテストケース用のタグを指定することも可能です:はSOAPUI-プロのmaven-pluginの

SOAP UI Specify a Tag

私は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> 

+0

あなたが何を後にしているかわかりません。このようなもの:https://siking.wordpress.com/2014/01/29/defining-test-categories-in-soapui/? – SiKing

答えて

0

あなたはシュアファイアプラグインに環境変数を指定するために探していますか?もしそうなら、これは動作するはずです:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <configuration> 
     <argLine>-Dmyenv=dev</argLine> 
    </configuration> 
</plugin> 
1

を、私はこの任意の程度や、私がSOAP UIを使用する、むしろ新しいですと、より良い方法があるかどうか間違っているなら、私を修正してください。あなたがはるかに良い答えを与えるならば、私はあなたのことを受け入れるでしょう。 SmartbearがMavenプラグインでタグを指定する方法をサポートすることを本当に願っています。

私はそれがnot possible to specify a tag via the Maven pluginであり、SOAP UIのサーバーバージョンはlarge amount of moneyであることを確認しました。私の状況では、タグを指定するコマンドラインメソッドを使用することはできません。

私はテスト用のタグ/カテゴリをシミュレートするために、環境に含める/除外したいすべてのテストをいくつかのテストスイートに移動することを考えました。残念ながら、1つのテストスイート(testSuiteパラメータを1つ指定する)またはすべてのテストスイート(testSuiteを空白のままにする)だけを実行することは可能です。

私は、Groovyスクリプトを使用してテストケースまたはスイートのタグを引き出し、それを実行するかどうかを判断するために使用できると思っていましたが、私が知る限り、テストケースまたはtestSuite(object modelAPI documentation)のタグ情報を取得します。

私は、カスタムプロパティ(testingOnly)で除外されるテストスイートをマーキングして、プロジェクトレベル「セットアップスクリプト」内の特定の環境(DEV)のものを無効に落ち着い:

// When running tests for the Dev environment, skip test suites with the property testingOnly=true 

def disableSuitesWithProperty(def propertyName) { 
    project.testSuiteList.each { testSuite -> 
     def isPropertyTrue = testSuite.getProperty(propertyName)?.getValue()?.toBoolean() ?: false; 

     if(isPropertyTrue) { 
      log.info "[Project Setup Script] Will Skip Test Suite: ${testSuite.name}"; 
      testSuite.setDisabled(true); 
     } 
     else { 
      log.info "[Project Setup Script] Will Execute Test Suite: ${testSuite.name}"; 
      testSuite.setDisabled(false); 
     } 
    } 
} 

if ("Dev".equals(project.getActiveEnvironmentName())) { 
    disableSuitesWithProperty("testingOnly"); 
} 

スイートがありますプロジェクトレベルの "TearDown Script"で再有効化されました。

// Reenable all test suites after all tests have run 

for (testSuite in project.testSuiteList) { 
    log.info "[Project TearDown Script] Reenabling Test Suite: ${testSuite.name}"; 
    testSuite.setDisabled(false); 
} 
関連する問題