2

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.

Charles
  • 31
  • 2

1 Answers1

1

All, the answer is this. My test class extends a class that uses a @BeforeSuite and @AfterSuite. When I added alwaysRun = true to the @BeforeSuite/@AfterSuite it worked as expected.

Charles
  • 31
  • 2