TestNg配置文件
<suite name="TestWeChat" parallel="tests" thread-count="1">
<parameter name="appPackage" value="com.tencent.mm"/>
<parameter name="appActivity" value="com.tencent.mm.ui.LauncherUI"/>
<test name="WeChat">
<classes>
<class name="BorwserEngin"/>
</classes>
</test>
</suite>
TestNg测试代码
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class BorwserEngin{
@Test
@Parameters({"appPackage","appActivity"})
public void parameter(String appPackage,String appActivity) {
System.out.println("应用包名="+appPackage);
System.out.println("应用启动页面="+appActivity);
}
}
测试结果
[RemoteTestNG] detected TestNG version 6.14.2
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >" at the top of your file, otherwise TestNG may fail or not work as expected.
应用包名=com.tencent.mm
应用启动页面=com.tencent.mm.ui.LauncherUI
===============================================
TestWeChat
Total tests run: 1, Failures: 0, Skips: 0
===============================================