Skip to content
VirtualLP Virtual Learning Platform
Testing Tools P18 intermediate

Organise web tests with TestNG and testng.xml

Run a TestNG class with priorities, groups, a data provider and a dependency, convert it to a testng.xml suite, filter by groups and watch a dependent test get skipped.

What you'll do

  • Use TestNG lifecycle annotations
  • Drive tests from a @DataProvider
  • Group tests and run them from testng.xml
  • Understand dependsOnMethods and skipped tests

Lab tasks

  1. 1 Add the TestNG library
  2. 2 Run the class as a TestNG test
  3. 3 Convert to a testng.xml suite
  4. 4 Run the suite with smoke + regression groups
  5. 5 Make validLogin fail and watch addToCart get skipped
  6. 6 Open the HTML report