Make Selenium Easy

TestNG Tutorials 65 : Dry Run Feature in TestNG

As a part of TestNG Tutorials, in this post we will see a new feature provided by TestNG called Dry run of test methods.

You may heard of the term “Dry Run” in Cucumber. If you want to check that every step in a feature file has its corresponding step definitions, we can run feature file with dryRun cucumber option.

Similar kind of feature is provided by TestNG now. If you want to see a list of the test methods that would be invoked on run without running them actually, you can use dry run feature. Remember it will give only @Test annotated methods not configuration methods like @BeforeXXXX and @AfterXXXX.

We will see an example so that it will be more clear to you:-


To run in dry run mode, we need to pass a JVM argument as -Dtestng.mode.dryrun=true

Go to Run configuration and select your project and pass argument as shown below:-

Now run and see output. You will see methods are called but was not run.

Let’s disable a test method and rerun:-

You can play around this feature with include and exclude groups. This feature is helpful to know if all your intended test methods will run or not.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Table of Contents

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.