[eclipse-testng plugin] "dependsOnMethods" not resolved when using fully qualified method name #32

fmisiak opened this Issue Nov 21, 2011 · 2 comments


None yet
3 participants

fmisiak commented Nov 21, 2011

reposting from cbeust/testng#132

Use case:
Suppose You have the following sources in an eclipse projects:

 package packageA;
 public class ClassOne {
     @Test(dependsOnMethods = {"packageB.ClassTwo.methodB"})
     public void methodA()
 package packageB;
 public class ClassTwo {
     public void methodB()

Now, from the Eclipse project Explorer (or package explorer, etc....), suppose you select "methodA" in ClassOne, right rick and select menu item "Run As/TestNG Test". You'll get the following error:

packageA.ClassOne.methodA() is depending on method public void packageB.ClassTwo.methodB(), which is not annotated with @Test
    at org.testng.internal.MethodHelper.findDependedUponMethods(MethodHelper.java:95)
    at org.testng.internal.MethodHelper.topologicalSort(MethodHelper.java:245)
    at org.testng.internal.MethodHelper.sortMethods(MethodHelper.java:316)
    at org.testng.internal.MethodHelper.collectAndOrderMethods(MethodHelper.java:51)
    at org.testng.TestRunner.initMethods(TestRunner.java:477)
    at org.testng.TestRunner.init(TestRunner.java:231)
    at org.testng.TestRunner.init(TestRunner.java:201)
    at org.testng.TestRunner.(TestRunner.java:157)
    at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:139)
    at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:269)
    at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:562)
    at org.testng.SuiteRunner.init(SuiteRunner.java:157)
    at org.testng.SuiteRunner.(SuiteRunner.java:111)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1212)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1199)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1053)
    at org.testng.TestNG.run(TestNG.java:974)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

You would expect instead that the plugin would resolve the dependency automatically and run before running the target method.

Note: If you set the dependency on a method that belongs to the same class (or a method defined in its super classes) then the dependency is correctly resolved (and more complex dependency chain seem to be resolve just fine).

The problem only occurs when the dependency points to a different class.

I debugged the issue to the implementation of:

org.testng.eclipse.util.JDTUtil.solveDependencies(MethodDefinition methodDef, Map parsedMethods)

I have a fix that I tested. I'll see if I can attach a patch file to this ticket.

Once my git/github environment is setup I'll propose a fix.


cbeust commented Nov 21, 2011

Great, thanks François. I've been meaning to fix this one for a while but never got around to doing it.

fmisiak commented Jan 3, 2012

see pull-request #44

cbeust added a commit that referenced this issue Oct 19, 2015

Merge pull request #178 from missedone/issue/32
fix issue #32 "dependsOnMethods" not resolved when using fully qualified method name

@missedone missedone closed this Oct 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment