O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

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

The @BeforeSuite, @BeforeTest, @BeforeGroups, @AfterGroups, @AfterTest, and @AfterSuite annotations

Those six annotations do not have their equivalents in JUnit. TestNG can group tests into suites, using XML configuration. Methods annotated with @BeforeSuite and @AfterSuite are run before and after all the tests in the specified suite have run. Similarly, the @BeforeTest and @AfterTest annotated methods are run before any test method belonging to the test classes has run. Finally, TestNG tests can be organized into groups. The @BeforeGroups and @AfterGroups annotations allow us to run methods before the first test and after the last test, in specified groups, are run.

While those annotations can be very useful when tests are written after ...

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