Inheritance + dependsOnMethods
See original GitHub issueTest case sample
public abstract class Base {
@Test
void test() {
assertEquals(getClass().getSimpleName(), "Test1");
}
}
class Test1 extends Base {
@Test(dependsOnMethods = "test")
void otherTest() {}
}
class Test2 extends Base {
@Test(dependsOnMethods = "test")
void otherTest() {}
}
Expected behavior
Actual behavior
TestNG Version
7.4.0 I do not know if it worked in the past
Is the issue reproducible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
I do not understand if actual behavior is intended or is a bug, but would that be ok to change it? if not, is there any option that I could override it?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
What are TestNG Dependent Tests and How to ... - Tools QA
In inherited dependent test methods in TestNG, we create dependency among the methods that belong to different classes, and one of the classes ......
Read more >TestNG Dependent Tests with Examples - HowToDoInJava
Tests with Single Test Dependency. Use dependsOnMethods to create a sample test method that depends on another test method of the same class....
Read more >TestNG dependsOnMethods from different class - java
DependsOnMethods cannot be used from different class ,To resolve this we can use dependsOnGroups; ... Using dependsOnGroups and inheritance
Read more >Using annotation inheritance for testing - Otaku – Cedric's blog
Here is how I would write this test using TestNG: @Test public correctVM() {} @Test public serverStartedOk() {} @Test(dependsOnMethods = { "correctVM", " ......
Read more >How to Run a Test only if Dependent Test Method Has Passed
Test; public class DependencyDemo { @Test(dependsOnMethods = { "TestB", ... Here's an example where the dependent methods are part of an inherited class....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@juherr - To be honest, I am not sure what should the behaviour be. I was just gathering information from @karolrom-intel so that we can figure out what to do with this. The current behaviour in my opinion is counter intuitive.
@krmahadevan I think the test inheritance is often used like “import tests from parent” (copy/paste). About a potential fix, it just means that the
test
name depends on the instance and not only on the declaring class. I will be curious to see if changing it will break tests or not.Do you see a valid use case for the current behavior?