TESTNG FEATURE-GROUPING OF TESTCASES

TESTNG FEATURE-GROUPING OF TESTCASES
Grouping is an important Feature of TestNG. This helps us to partition the tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.
Groups are specified in your testng.xml file and can be found either under the or tag.
Groups specified in the tag apply to all the tags underneath.
Note that groups are accumulative in these tags: if you specify group “a” in and “b” in , then both “a” and “b” will be included.

For example, it is quite common to have at least two categories of tests

Check-in tests: These tests should be run before you submit new code. They should typically be fast and just make sure no basic functionality was broken.

Functional tests : These tests should cover all the functionalities of your software and be run at least once a day, although ideally you would want to run them continuously.
Its evident that when ever the build provided to the QA team, for quick round of testing to
confirm the build is working fine by running “sanity” group of testcases.

XML File:

Refer to the link for information->http://testng.org/doc/documentation-main.html

Inclusion & Exclusion of Groups:

In TESTNG we can even mark a Single @Test that belongs to more then one group as well. Mark tests as sanity,regression and classify the tests based on critical,high,medium and low as shown below:

Refer to the testng xml file:

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *