Based on my understanding, I am elaborating your question with an example. [ If this is not what you were asking, I would request you to please help elaborate your question ]
public class TestClass {
@Test
public void independent() {
System.out.println("Hello World")
}
@Test(dependsOnMethods = "independent", retryAnalyzer = IRetryFailures.class)
public void dependent() {
//some logic goes here which is flaky enough to trigger failures
}
}
Your expectation is that, when the method dependent() has a failure and it is being retried by the retryAnalyser, you expect that independent() should also be invoked.
Explanation :
That is not how TestNG works.
When you mentioned that dependent() has a dependency on the method independent() then you have in a way established a pre-requisite for the method dependent() to be executed i.e., you have instructed TestNG : "Dear TestNG, please execute the method dependent() if and only if the method independent() passes".
Now the fact that the method dependent() was executed and it failed (for whatever reasons) and your retry analyser is being invoked emphasises that TestNG fulfilled your pre-requisite already. So why would it need to keep trying to fulfil the same pre-requisite every time the method dependent() is being retried by the retry analyser ?
The retry analyser is expected to only attempt at retrying to current failed test method and not attempt at traversing up the hierarchy and try and fulfil every pre-requisite once again.
Please let me know if that explanation makes sense.