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 the Before and After annotations

  1. Perform the following steps to run the Before and After annotations: Open Eclipse and create a Java Project with following structure. Please make sure that TestNG library is added to the build path of the project as mentioned in Chapter 1, Getting Started.
    Time for action – running the Before and After annotations
  2. Add the following code to the TestClass.java file shown in the previous screenshot:
    package test.beforeafter; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterGroups; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeClass; ...

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