使用ANT动态调用属性文件



i设置jenkins作业,使用Apache Ant触发SOAPUI API自动化套件。我想要在运行套件之前,应该先调用外部属性文件并加载属性。

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:IntegerationAPIAPIPackageProperty_FilesVisitorSearchProperties.Properties

如何完成?

您需要做的就是将JVM参数如下传递给test Runner命令。

在项目级别加载外部属性文件-dsoapui.properties。=

在测试套件级别加载外部属性文件-dsoapui.properties。=

来到您的情况下,将下面添加到您现有的testRunner命令中:

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

您可以如下更改soapui目标,请注意arg元素的开始的更改。

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

相关内容

  • 没有找到相关文章

最新更新