如何基于命令行参数中提供的参数在testng.xml中执行特定测试用例

时间:2020-09-15 08:06:07

标签: java testng.xml

我是testng的新手,我有一个要求,我们必须根据提供的参数在testng.xml文件中执行测试用例。

For example :
My testng.xml file has 
<test name="Test1">
        <classes>
            <class name="tests.test1">
                <methods>
                <include name="NewIndividual"/>
                <include name="NewOrganization"/>   
              </methods>
            </class>
        </classes>
</test>

I have to pass a parameter from command line as entity='Individual'. If the entity is passed as individual then NewIndividual test case alone should execute and the other should not execute . if entity='Org' is passed as parameter NewOrganization alone should execute.

我发现注释转换器可以解决此问题,但不确定如何使用它。 我想添加一个条件,例如,如果entity ='Individual'执行NewIndividual情况。 有人可以帮我吗?

预先感谢

0 个答案:

没有答案