TestNG

TestNG (Test Next Generation) is a popular open-source testing framework for Java. It is designed to simplify various aspects of automated testing, including unit testing, integration testing, and end-to-end testing, while providing advanced features and flexibility for test configuration and execution.

TestNG is widely used in the Java community and is often seen as an alternative to JUnit.

Related Tags

Tutorials

TestNG

TestNG Tutorials

TestNG is a test automation framework inspired by JUnit. It can be used for unit testing, functional, integration, and end-to-end testing.

TestNG – Parallel Test Execution

TestNG parallel execution of tests, classes and suites. Learn to run multiple tests in different threads or a single test in multiple threads.

TestNG @Factory with Examples

Learn about the TestNG @Factory annotation that allows the tests to be created at runtime depending on provided datasets or conditions. 1. When to use TestNG @Factory? Sometimes we may need to run a set of tests with different data values. To achieve this we may define a separate set …

TestNG Dependent Tests with Examples

TestNG allows a test method to be dependent on a single or a group of test methods so that dependent tests are executed before the given test.

TestNG – Test Groups with Examples

The ability to group the related tests is one of the most important features of TestNG. Users can group multiple tests into a named group. The user can execute a particular set of tests belonging to a group or multiple groups. The test grouping feature allows the tests to be …

TestNG @Parameters

TestNG parameterization feature allows user to pass parameters to tests as arguments. This is supported by using the testng @Parameters annotation.

TestNG Test Timeouts

Learn to configure TestNG tests to timeout after some pre-configured duration. Learn to configure timeout for test method, class and suite.

TestNG – Disable or Ignore Tests

When executing TestNG tests, there may be some scenarios where you may have to disable a particular test or a test suite from getting executed. For example, consider a scenario where a serious bug exists in a feature due to certain tests belonging to certain scenarios that cannot be executed. …

TestNG – Expected Exceptions

Learn to write TestNG exception-based tests using the expectedExceptions attribute and assert messages with expectedExceptionsMessageRegExp.

TestNG – Test LifeCycle

TestNG before and after annotations. @BeforeSuite, @AfterSuite, @BeforeTest, @AfterTest, @BeforeGroups, @AfterGroups, @BeforeClass, @AfterClass, @BeforeMethod and @AfterMethod.

TestNG Annotations

TestNG uses annotations to help developers to write the tests. Let us learn a few important testng annotations and their lifecycle.

Setting Up TestNG in Eclipse

Learn about TestNG features, installing the TestNG plugin into Eclipse and writing and executing TestNG tests through Eclipse IDE.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.