TestNG Suites Example

In this post we will learn about TestNG Suite test. A Suite in TestNG is commonly represented by one XML file, usually named as testng.xml. <suite> tag is the first tag in XML file which represents a suite and it may contains one or more <test> tags. Each <test> tag in turn may contain one…

Continue reading

TestNG Groups Example

In this post we will learn about how to use TestNG groups testing feature using @BeforeGroups, @AfterGroups and group exclusion. TestNG allows us to group several tests together. You can group certain tests based on what behavior/aspect they are actually testing. You may have a scenario where few tests belong to a certain group(say database)…

Continue reading

TestNG Annotations Example

In this post we will learn common TestNG annotations including @Test, @BeforeMethod, @AfterMethod, @BeforeClass, @AfterClass, @BeforeGroups, @AfterGroups, @BeforeSuite, @AfterSuite, @BeforeTest & @AfterTest. Further posts next in tutorial explains in detail other popular annotations including @Parameters & @DataProvider annotations. Previous post gave an introduction to TestNG. In this post, we will start using annotations in very…

Continue reading

TestNG Hello World Example

In this post we will learn a very basic Hello World example using TestNG. We will learn how to setup environment to use testNG and how to actually write & execute unit tests and verify results. We will be using maven based project. Let’s begin. Following environment being used: TestNG 6.9.4 Maven 3 JDK 1.7…

Continue reading