You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codelens appears for the abstract test class even though it cannot be run directly (IntelliJ redirects you to the classes that inherit from the abstract class instead ...)
Codelens does not appear on the classes that inherit from the abstract test class
Sidebar only runs tests in abstract class resulting in InstantiationException because it's abstract.
After thinking about this, the Java Test Runner seems to have access to the class tree because it is able to build the explorer tree. It'd be useful to instead mark up this tree with whether or not this class has tests through the tree (and whether or not it can be run if it's abstract). Not sure if this is possible to translate codewise. If you want, I can look deeper in the code w/ some help
Yes, since the Test Runner is an extension of the Java Language Server, it has the knowledge of the classes actually. It would be great if you are willing to help. Any contributions are welcome!
Same issue here. A class "B" that inherits tests from class "A" cannot be executed, neither from explorer java projects view, nor from testing view. How are we supposed to run those tests now? Any hint or workaround? In eclipse this wasnt a problem at all.
Hi Gerald Aryeetey (@GeraldNDA), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
The Java Test extension currently doesn’t surface CodeLens on concrete subclasses that inherit tests from an abstract base. You’ll only see the Run/Debug CodeLens on the abstract superclass (which fails with InstantiationException).
Workarounds:
Use the Test Explorer view (or the Java: Run All Tests / Java: Run Test commands) and select your concrete subclass there.
Add dummy test methods in the subclass to force CodeLens to appear on that class.
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
When using JUnit 5 contract tests with an abstract base test class (tests defined in the abstract class, concrete subclasses provide implementations), VS Code has no way to run all child implementations or choose which subclass to run.
The Java Test Runner only allows running each concrete subclass manually. In IntelliJ IDEA, you can run the abstract test and select one or all subclasses, which is very useful for contract testing.
Some UI support for “run all subclasses” or selecting child implementations would greatly improve this workflow.
Activity
GeraldNDA commentedon Jun 1, 2019
Sample Project (with failing tests under polytests)
JTestBug.zip
GeraldNDA commentedon Jun 2, 2019
GeraldNDA commentedon Jul 16, 2019
After thinking about this, the Java Test Runner seems to have access to the class tree because it is able to build the explorer tree. It'd be useful to instead mark up this tree with whether or not this class has tests through the tree (and whether or not it can be run if it's abstract). Not sure if this is possible to translate codewise. If you want, I can look deeper in the code w/ some help
jdneo commentedon Jul 16, 2019
Thank you for the suggestion Gerald Aryeetey (@GeraldNDA).
Yes, since the Test Runner is an extension of the Java Language Server, it has the knowledge of the classes actually. It would be great if you are willing to help. Any contributions are welcome!
benzman81 commentedon Feb 21, 2022
Same issue here. A class "B" that inherits tests from class "A" cannot be executed, neither from explorer java projects view, nor from testing view. How are we supposed to run those tests now? Any hint or workaround? In eclipse this wasnt a problem at all.
benzman81 commentedon Feb 21, 2022
Btw. our test framework is TestNG.
jdneo commentedon Feb 22, 2022
Markus Krüger (@benzman81) Thanks for reporting.
There will be some problem for TestNG in such cases. JUnit should be fine.
github-actions commentedon Nov 13, 2025
Hi Gerald Aryeetey (@GeraldNDA), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
The Java Test extension currently doesn’t surface CodeLens on concrete subclasses that inherit tests from an abstract base. You’ll only see the Run/Debug CodeLens on the abstract superclass (which fails with InstantiationException).
Workarounds:
Java: Run All Tests/Java: Run Testcommands) and select your concrete subclass there.Tracking issue:
• Run tests on class does not take inherited methods into consideration #435
Other references with low confidence
• No other relevant issues found.
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
XuPengfei-1020 commentedon Dec 1, 2025
Any plan to fix it?
youssefoubrik commentedon Feb 4, 2026
This issue still exists.
When using JUnit 5 contract tests with an abstract base test class (tests defined in the abstract class, concrete subclasses provide implementations), VS Code has no way to run all child implementations or choose which subclass to run.
The Java Test Runner only allows running each concrete subclass manually. In IntelliJ IDEA, you can run the abstract test and select one or all subclasses, which is very useful for contract testing.
Some UI support for “run all subclasses” or selecting child implementations would greatly improve this workflow.