我正在使用带有参数的TestNG,并且它可以很好地完成一项测试。但是,一旦添加另一个测试,参数就会开始混乱。他们没有使用xml文件中定义的自己的参数,而是仅使用一个测试的参数。
<suite name="Test suite" >
<parameter name="key" value="value_1"/>
<test name="Test1" >
<classes>
<class name="package.Test" >
<methods>
<include name="method1" />
</methods>
</class>
</classes>
</test>
<parameter name="key" value="value_2"/>
<test name="Test2" >
<classes>
<class name="package.Test" >
<methods>
<include name="method1" />
</methods>
</class>
</classes>
</test>
</suite>
例如,在此文件上,Test1和Test2都使用key
,其值为value_1
。这是我在设置中调用参数的方式(我使用@BeforeMethod,因为BrowserStack需要它)
@Parameters(value={"key"})
@BeforeMethod(alwaysRun=true)
public void setup(String key) {
是否有发生这种情况的原因?我找不到其他遇到相同问题的人
如果要并行执行测试,我建议您使用BrowserStack Sample TestNg GitHub Repo,如下所述。对我来说很好。https://github.com/browserstack/testng-appium-app-browserstack