Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

TestNG Tutorials 64: Dependency in TestNG – ignoreMissingDependencies – Another Way of Achieving Soft Dependencies

Posted on 04/23/2025 By admin

Hello Folks,

There are two types of dependencies in TestNG:

1. Hard Dependency : All the methods you depend on must have run and succeeded for you to run. If at least one failure occurred in your dependencies, you will not be invoked and marked as a SKIP in the report.

2. Soft Dependency : You will always be run after the methods you depend on, even if some of them have failed. This is useful when you just want to make sure that your test methods are run in a certain order but their success doesn’t really depend on the success of others. A soft dependency is obtained by adding “alwaysRun=true” in your @Test annotation.

You can go through about above concept in this post.

But consider below scenarios:

  1. How you will run your test which depends on another tests and that tests does not exist always or need to execute based on some conditions?
  2. How you will run your test which depends on another tests which are marked false for “enabled” attribute.

First, let’s see what happens when you run  a test which depends on another test and that test is missing.

package Dependency;


import org.testng.annotations.Test;

public class HardDependeny {
        
        
        /*
         * This test method depends on another test method named "Test1" which does not exist.        
         */
        @Test(dependsOnMethods= {"Test1"})
        public void Test2()
        {
                System.out.println("I am Test2");
        }
        
        
}

Output:

[java] [RemoteTestNG] detected TestNG version 6.14.2 org.testng.TestNGException: Dependecy.HardDependeny.Test2() depends on nonexistent method Test1 at org.testng.internal.MethodHelper.findDependedUponMethods(MethodHelper.java:114) at org.testng.internal.MethodHelper.topologicalSort(MethodHelper.java:241) at org.testng.internal.MethodHelper.sortMethods(MethodHelper.java:317) at org.testng.internal.MethodHelper.collectAndOrderMethods(MethodHelper.java:64) at org.testng.TestRunner.initMethods(TestRunner.java:438) at org.testng.TestRunner.init(TestRunner.java:271) at org.testng.TestRunner.init(TestRunner.java:241) at org.testng.TestRunner.(TestRunner.java:192) at org.testng.remote.support.RemoteTestNG6_12$1.newTestRunner(RemoteTestNG6_12.java:33) at org.testng.remote.support.RemoteTestNG6_12$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_12.java:66) at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:713) at org.testng.SuiteRunner.init(SuiteRunner.java:260) at org.testng.SuiteRunner.(SuiteRunner.java:198) at org.testng.TestNG.createSuiteRunner(TestNG.java:1295) at org.testng.TestNG.createSuiteRunners(TestNG.java:1273) at org.testng.TestNG.runSuitesLocally(TestNG.java:1128) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

Uncategorized

Post navigation

Previous Post: #4. OAuth 2.0 Flow – What Is A Bearer Token?
Next Post: Postman Tutorial Part 10 – Sending PATCH Request in Postman

Related Posts

IMG_6688[1] – Make Selenium Easy Uncategorized
March 31, 2018 – Make Selenium Easy Uncategorized
Postman Tutorial Part 3 – Sending First GET Request in Postman – Make Selenium Easy Uncategorized
TestNG Tutorials 39: Run Only Test From a TestNG Class Without Using TestNG XML? Uncategorized
yatraMultiCLass – Make Selenium Easy Uncategorized
July 2018 – Page 3 – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark