TestNG Annotations
Common Annotations
@Test— marks a method as a test case.@BeforeMethod/@AfterMethod— run before/after each test method.@BeforeClass/@AfterClass— run once before/after all tests in a class.@BeforeSuite/@AfterSuite— run once before/after the entire suite.@DataProvider— supplies multiple sets of data to a test method for data-driven testing.
Why Annotations Matter
Annotations let testers precisely control the setup and teardown lifecycle around each test, avoiding repeated boilerplate code.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.
.png)