O'Reilly logo

TestNg Beginner's Guide by Varun Menon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – running test classes in parallel

Perform the following steps to create test classes in parallel:

  1. Create new class with the name SampleTestClassOne under the test.parallelism package and replace the following code in it:
    package test.parallelism; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class SampleTestClassOne { @BeforeClass public void beforeClass(){ long id = Thread.currentThread().getId(); System.out.println("Before test-class. Thread id is: "+id); } @Test public void testMethodOne() { long id = Thread.currentThread().getId(); System.out.println("Sample test-method One. Thread id is: "+id); } @Test public void testMethodTwo() { long id = Thread.currentThread().getId(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required