...
TestNG has the capability to categorize tests into groups. For our acceptance test framework, the tests we're writing now are all part of the `acceptance` group. Each feature area also has a associated group - e.g. `client`, `loan`, etc. Finally, the build validation tests or "smoke" tests all have the test group "smoke". Smoke tests are the tests run by default on a developer's build, whereas all acceptance tests are run on the continuous integration server. The smoke group should be used sparingly.
Smoke tests or other categories can be grouped so all tests within a single test class are run. However, many times you might only want a subset of tests to be run during the smoke tests, as each test extends the time of each developer's build. To make a single test method run during the smoke group, you need to add the testng groups parameter before your test method. e.g. @Test(groups = "smoke")
. Also, when flagging a single test method, the BeforeMethod and AfterMethod in your test class must always be run by adding (alwaysRun = true)
. See ClientTest.java for an example.
...