将变量从jenkins传递给testng.xml
我想根据从jenkins传递的变量运行测试用例,例如,选择要运行的测试用例:testcaseOne,testcaseTwo
在pom.xml(maven)中:
org.apache.maven.plugins maven-surefire-plugin 2.18.1 testng.xml ${chooseCase} <--this dont work tests 10
我有两个testng @test方法:
@Test(groups="caseOne") @Test(groups="caseTwo")
我的testng.xml文件:
如何传递此参数取决于我想要运行的测试数量和数量? 也许有完全不同的方式来做到这一点?
您可以在testng.xml文件http://testng.org/doc/documentation-main.html#beanshell中使用BeanShell脚本并读取其中的系统变量,例如: