TestNG enabled example

In this post we will learn how to disable or ignore a test using @Test(enabled=false). Occasionally, we want to disable some tests because of some reasons(like a particular api being tested in those tests is changing but we don’t want to stop the complete CI build which apart from this API should be working fine)….

Continue reading

Maven Surefire plugin & TestNG

In this post we will learn how to execute TestNG tests with Maven using maven-surefire-plugin. This post also goes over explaining TestNG XML configuration file (aka Suite, testng.xml) , it’s purpose, it’s content, it’s location in your project and how to use it for your tests [using Eclipse plugin or Maven]. Let’s begin. What is…

Continue reading

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