When running test suite using testNG xml, the test will run fine and all of the parameters from the xml file are used as expected. The moment I added grouping to my @Test Methods, and add the groups xml I get a failed:java.lang.nullpointerException. The @Test run perfectly when running the Class or from the XML.
BEFORE: All runs fine
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
<parameter name="User" value="Admin"/>
<parameter name="Password" value="something"/>
<test name="ExampleTest" >
<classes>
<class name="test1"/>
<class name="test2"/>
</classes>
</test>
</suite>
AFTER - @BeforeClass fails with Null.PointerException
<suite name="Suite1" verbose="1" >
<parameter name="User" value="Admin"/>
<parameter name="Password" value="something"/>
<test name="ExampleTest" >
<groups>
<run>
<include name = "setup"/>
<exclude name = "functional"/>
<include name = "regression"/>
</run>
</groups>
<classes>
<class name="test1"/>
<class name="test2"/>
</classes>
</test>
</suite>
NOTE: I've tagged the @BeforeClass with @BeforeClass(groups = {"setup"}) and it does not work.
question from:
https://stackoverflow.com/questions/65861057/testng-parameters-are-not-recognized-when-using-groups 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…