无法从VM参数读取值到testng.xml文件

时间:2018-09-11 14:47:10

标签: maven ant testng

我正在尝试通过Eclipse从Maven Run配置读取VM参数。但是我无法读取输入内容。

TestNG.xml

String TestSuiteName;
String SoapUISuiteFile;

@Parameters({ "SoapUISuiteFile","TestSuiteName" })
@BeforeClass
public void beforeClass(String SoapUISuiteFile,String TestSuiteName) {

    System.out.println("Entered into before class");
    System.out.println("TestSuiteName "+TestSuiteName);
    this.TestSuiteName = TestSuiteName;

    this.SoapUISuiteFile = System.getProperty("user.dir")+"\\resources\\"+SoapUISuiteFile;

}

VM参数:

-DTestSuiteName =烟雾

TestNG.xml

<?xml version="1.0" encoding="UTF-8"?>

<listeners>
    <!-- <listener class-name="com.cs.ui.report.ExtReportListener" />  -->
    <listener class-name="com.acxsys.ocp.api.emt.ks.report.EMTReportListener" />
</listeners>
<test name="SOAP UI JAVA">
 <parameter name="TestSuiteName" value="Sanity"/>
 <parameter name="SoapUISuiteFile" value="kevin-poc-soapui-project.xml"/>
    <classes>
        <class name="com.acxsys.ocp.api.emt.sanity.SoupOCPAutomationRunner" />
    </classes>
</test>

我正在尝试从VM读取一个值并将其设置为testng.xml,但它不会覆盖现有值。

0 个答案:

没有答案