ANT

2017-09-11 9 views
0

を使用してsoapuiにプロパティファイルを動的に呼び出します。Apache ANTを使用してSoapUI APIオートメーションスイートを起動するためにjenkinsジョブをセットアップしました。 スイートを実行する前に、まず外部プロパティファイルを呼び出してプロパティをロードする必要があります。ANT

のbuild.xml:

<project name="soapUI Nightly Build" default="testreport" basedir="."> 

<target name ="soapui">  
<exec dir="." executable="C:/IntegerationAPI/APIPackage/SoftwareRequired/SoapUI/SoapUI-5.2.1/bin/testrunner.bat"> 
<arg line="-j -f 'C:/Program Files (x86)/Jenkins/workspace/IntegerationAPI-2' 'C:/IntegerationAPI/APIPackage/SOAP_Script/VisitorSearchAPI-soapui-project.xml'"/> 
</exec> 
</target> 

<target name ="testreport" depends ="soapui"> 
<junitreport todir="C:/Program Files (x86)/Jenkins/workspace/IntegerationAPI-2"> 
    <fileset dir="C:/Program Files (x86)/Jenkins/workspace/IntegerationAPI-2"> 
     <include name="TEST-*.xml"/> 
    </fileset> 
    <report todir="C:/Program Files (x86)/Jenkins/workspace/IntegerationAPI-2/HTML" 
      styledir="C:/apache-ant-1.9.6-bin/apache-ant-1.9.6/etc" 
      format="noframes"> 

    </report> 
</junitreport> 
</target> 

</project> 

プロパティファイルのパス:

C:\IntegerationAPI\APIPackage\Property_Files\VisitorSearchProperties.Properties 

はどのようにこれを行うことができますか?

+0

私は従いませんが、Ant [propertyfile task](http://ant.apache.org/manual/Tasks/propertyfile.html)は使用できませんか? –

+0

どこにロードする必要がありますか? 'build.xml'には?またはsoapuiプロジェクト/スイート? – Rao

+0

スクリプトの最初に ''タスクを使用するだけで問題はありますか?あなたはそれが動的に読み込まれるようにしたいと言っていますが、その部分がどのような方法で動的である必要があるかを示していません。スクリプト内の他のファイルパスはすべてハードコードされていますが、なぜ同様の問題ではないのですか? – CAustin

答えて

1

以下のようにjvm引数をテストランナーコマンドに渡すだけです。プロジェクトレベル -Dsoapui.propertiesで外部プロパティファイルをロードするために

。=

テストスイートレベル -Dsoapui.propertiesで外部プロパティファイルをロードします。=

あなたのケースに来て、既存のテストランナーコマンドに以下の追加:

-Dsoapui.properties.VisitorSearch_API=C:/IntegerationAPI/APIPackage/Property_Files/VisitorSearchProperties.Properties 

あなたはarg要素の開始の変化に注意し、以下のようにあなたのsoapuiターゲットを変更することができます。

<target name ="soapui">  
    <exec dir="C:/IntegerationAPI/APIPackage/SoftwareRequired/SoapUI/SoapUI-5.2.1/bin" executable="testrunner.bat"> 
     <arg line="-Dsoapui.properties.VisitorSearch_API=C:/IntegerationAPI/APIPackage/Property_Files/VisitorSearchProperties.Properties -j -f 'C:/Program Files (x86)/Jenkins/workspace/IntegerationAPI-2' 'C:/IntegerationAPI/APIPackage/SOAP_Script/VisitorSearchAPI-soapui-project.xml'"/> 
    </exec> 
</target> 
+0

' 'まだ取得中同じ結果。新しいパラメータによる結果への影響はありません。私のプロジェクトxmlは既にプロパティを持っています。既存のパラメータを上書きしているわけではありません。 – rAJ

+0

testrunnerユーティリティを使用してコマンドラインで最初に試すことはできますか?ところで、どのようにそれがオーバーライドしているかどうかを知っていますか?あなたはどこにロギングしていますか?ログを見せてもらえますか? – Rao

+0

私はこれを 'C:\ IntegerationAPI \ APIPackage \ SoftwareRequiC:\ Windows \ system32> C:\ IntegerationAPI \ APIPackage \ SoftwareRequired \ SoapUI \ SoapUI -5.2.1 \ bin \ testrunner.bat -j -f 'プログラムファイル(x86)/ Jenkins/workspace/Intege rationAPI-2 '' C:/ IntegerationAPI/APIPackage/SOAP_Script/VersionInformation-soapu i-projectxml '"'と出力は 'Missing SoapUI project file..'です。出力htmlレポートファイルは常に同じですので、xmlファイルに存在する古いプロパティを使用して新しいプロパティを取得していないと言います。 – rAJ