Tuesday 5 July 2022

TestNG How To Do Parallel Testing | Selenium Parallel Testing TestNG | Running Tests Parallel

                  In this post, we will see TestNG How To Do Parallel Testing | Selenium Parallel Testing TestNG | Running Tests Parallel 


Program Code (Program1.java):

package mytest;


import org.testng.Assert;

import org.testng.annotations.Test;


public class Program1 {


@Test

public void AdmissionLogin()

{

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

Assert.assertTrue(false);

}

@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 mytest;


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 (testng.xml):

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

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

<suite name="Suite" parallel="tests" thread-count="2">


  <test name="Test1" parallel="classes" thread-count="2">

  <classes>

  <class name="mytest.Program1"></class>

  <class name="mytest.Program2"></class>

  </classes>

  </test> <!-- Test -->

  

  <test name="Test2">

  <classes>

  <class name="mytest.Program3"></class>

  </classes>

  </test> <!-- Test -->

  

</suite> <!-- Suite -->


Watch following video:


Watch on YouTube: https://www.youtube.com/watch?v=g6gbmw46o_A

No comments:

Post a Comment