How can i execute the different class files using exclude and include in testng.xml

tsivarajan Source

login page class

public class LoginTest extends AppKeyFunctions{
    public LoginTest() throws IOException {}

  @Test(groups= {"login"})
  public void login() throws Exception {
      loginToApplication();
  }
}

Add New Course class

public class AddNewCourse extends AppKeyFunctions{
    public AddNewCourse() throws IOException {}

  @Test(groups= {"addCourse"})
  public void addTheNewCourse() throws Exception {
      loginToApplication();
      clickCourseInHomePage();
      clickAddButton();
      enterTheCourseDetails(title,description,duration,price,1);
      clickTheSaveButton();
      this.verifyTheNewlyCreatedCourseDetailsInDatabase();
  }
}

testng.xml file

<suite name="Suite">
    <test name="all-test">
        <groups>
            <run>
                <exclude name="login" />
                <include name="addCourse"/>
            </run>
        </groups>
        <packages>
            <package name="com.oslos.testsuites" />
        </packages>
    </test>
</suite>

I want to execute two different class files in package(com.oslos.testsuites) by using testng.xml but its showing NullPointerException when i execute the xml file.

javaselenium-webdrivertestng

Answers

answered 6 months ago Arun Chettur #1

Try creating and give your classname inside it with package name.

eg:-

  <class name="packagename.classname"/>

</classes>

  <class name="packagename.classnameTwo"/>

</classes>

comments powered by Disqus