Introduce `@DependsOn` to prioritize test method execution order
@Update: Now it works exactly like TestNG, which means if A depends on B, and B is disabled, then A is disabled as well.
Hi everyone,
I am creating a pull request for this feature. It should work similar to TestNG (@Test(dependsOn = ...)) but it will not disable the test if some test fails. It just gives methods a priority like @Order.
It would be great if someone can give me some advice how to improve it.
Thank you :)
Tentatively slated for 5.5 M1 for the purpose of team discussion.
Hi @duckladydinh,
Thanks for opening the issue and submitting the PR!
I am creating a pull request for this feature. It should work similar to TestNG (
@Test(dependsOn = ...)) but it will not disable the test if some test fails. It just gives methods a priority like@Order.
Although I think there is merit in mere "dependent ordering" as in the PR, I think it would be worth investigating the possibility for "not executing" methods if a method that they depend on fails.
For example, if C depends on A and A fails, then C should be aborted. That's basically what TestNG does, and I think it might be possible to implement this elegantly in JUnit Jupiter by implementing the TestWatcher API introduced in JUnit Jupiter 5.4. Of course, I have not tried to implement it myself, so I'm just thinking out loud here.
Hi @sbrannen , thank you for the suggestion. I think I have something done already based on your suggestion. My design is to keep the DependsOnAnnotation as it is, and add a separate TestWatcher :).
Hi is there any update on when this PR might be merged in. There hasn't been any follow up since end of last year. Thank you.
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.
Hi. I wanted to check in if there is any update or concerns? This is one of the features available in TestNG that I miss when working in JUnit5. It helps isolate problems in tests when you have good dependency management.
Also checking about this, this feature would be very usable, is it going to be merged?
Any news here?
@ahoehma, this issue still has the waiting-for-interest label.
This feature would be very useful
I am still interested.
I'm not sure what happened here, but this would be a useful feature to have. It's something that TestNG can do, and the lack of support makes migrating from TestNG to JUnit difficult.