Sunday 19 June 2022

How To Add Packages To testng.xml File in TestNG Framework | Run TestNG Testcases At Packages Level

                      In this post, we will see How To Add Packages To testng.xml File in TestNG Framework | Run TestNG Testcases At Packages Level


Program Code (Program1.java)

package mytest;


import org.testng.annotations.Test;


public class Program1 {


@Test

public void AdmissionLogin()

{

System.out.println("Admission Login");//code for testcase

}

@Test

public void AdmissionBrokenlinks()

{

System.out.println("Admission Broken links"); //code for testcase

}


}



Program Code (Program2.java):

package mytest;


import org.testng.annotations.Test;


public class Program2 {


@Test

public void PlacementLogin()

{

System.out.println("Placement Login");//code for testcase

}

@Test

public void PlacementBrokenlinks()

{

System.out.println("Placement Broken links"); //code for testcase

}

}


Program Code (Program3.java):

package mytest2;


import org.testng.annotations.Test;


public class Program3 {


@Test

public void FacultyLogin()

{

System.out.println("Faculty Login");//code for testcase

}

@Test

public void FacultyBrokenlinks()

{

System.out.println("Faculty Broken links"); //code for testcase

}


}


Program Code (testng2.xml):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">

<suite name="Suite">


  <test name="Admission">

    

    <packages>

    

    <package name="mytest2"></package>

    

    </packages>

    

  </test> 

   

</suite> 


Watch following video:


Watch on YouTube: https://www.youtube.com/watch?v=3YEJ3dX52-c

No comments:

Post a Comment