Posts about TestNG

Repeating a test invocation by time period in TestNG

Problem statement As a user, I would like to be able to repeat a test n times but for a particular time duration. The approach On a high…


Retrying configuration methods in TestNG

Problem statement Build a capability such that configuration methods can be retried if there's a failure in a previous attempt. Pre…


Reporting consolidated TestNG result for tests that use data providers

Problem statement: I use data provider for parameterized tests. I understand that the test method execute once for every instance in the…


,

Thread Affinity in TestNG

Most of us would have at some point or the other built a Selenium based TestNG test that kind of looks like below: When running this above…


Dynamic parameterization in TestNG

TestNG provides us users with two ways in you can achieve data driven tests. You make use of the annotation wherein you bind your method…


Automatically wire-in a parent Guice-module into your TestNG test

What is dependency injection ? Quoting WikiPedia, here’s the definition of dependency injection: In software engineering, dependency…


Building Dynamic TestNG Suites

We have all at some point wished that we had a way wherein we could dynamically build the TestNG suite xml file based upon some parameters…


Running setup only once per Test/Suite Without Using @BeforeSuite/@BeforeTest

Running setup only once per Test/Suite Without Using @BeforeSuite/@BeforeTest This is a common question that I am noticing asked by many…


Dears Listeners…stand in Q please

Dears Listeners…stand in Q please Yes, you read the title right.. but I was not hinting at you the readers.. but I was referring to the…


,

Testcase specific logs for a Selenium project

Testcase specific logs for a Selenium project Problem statement: You would like to have a separate log file for every testcase so that if…


How to run test methods in parallel but test classes in sequence

How to run test methods in parallel but test classes in sequence This question came up recently on the TestNG forum. Since when solving this…


Working with @TestInstance annotation

Working with @TestInstance annotation Sometimes one would need to gain access to the test class instance to which an annotated test method…


Parallel execution of multiple TestNG suites

Parallel execution of multiple TestNG suites If we would like to run more than one TestNG suite in parallel, here’s how to go about doing it…


Running tests which don’t have TestNG annotations

Running tests which don’t have TestNG annotations This question came up very recently on the TestNG forum and I found it to be quite…


What are data providers in TestNG

What are data providers in TestNG Data providers is a very common need when you are building tests that are data driven in nature. TestNG…


Sharing data across Tests in different TestClasses

Sharing data across Tests in different TestClasses So today I saw another interesting question posted on the TestNG-Users google forum. How…


Sharing parameters among different TestNG suites

Sharing parameters among different TestNG suites Off late I have been seeing a couple of queries every now and then which asks How do I…


BeanShell and TestNG

BeanShell and TestNG Very recently someone asked a question if I could have the luxury of referring to VM arguments in the TestNG Suite XML…


,

Parallel WebDriver executions using TestNG

Parallel WebDriver executions using TestNG In this post, we will see how does one make use of TestNG to kick off parallel UI tests using…


Pretty Printing with TestNG

We all at some point or the other have had to deal with tests that are data driven. One of the frequently asked question that I have seen on…


Using the listener factory in TestNG

Using the listener factory in TestNG Sometime back I stumbled into a in TestNG. I have tried hunting for information about it, but so far…


Working with Threads in TestNG

Working with Threads in TestNG Sometime back, me and my friend were trying to play around with Threads in annotated TestNG methods and we…


Listen to what I have to say about “TestNG” Listeners

“Listen” to what I have to say about “TestNG” Listeners What are these listeners ? What does TestNG stand to offer to us with them ? This…