Introduce support for aborting JUnit 4 and TestNG tests in AOT runtime #31478
Labels
in: test
Issues in the test module
status: declined
A suggestion or change that we don't feel we should currently apply
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Overview
The
@DisabledInAotMode
annotation introduced in conjunction with #30834 disables any test class during AOT processing, but it only disables JUnit Jupiter tests during AOT runtime (via a JUnit JupiterExecutionCondition
).If we want to provide similar support for JUnit 4 and TestNG based tests, we would need to take a different approach -- for example, by aborting tests via an exception.
JUnit 4 supports
org.junit.AssumptionViolatedException
for this purpose.TestNG supports
org.testng.SkipException
for this purpose.These types of exceptions could be thrown from dedicated
TestExecutionListener
implementations or via static utility methods that we could make available to users.For example, the following works for JUnit 4.
And the following works for TestNG.
A proof-of-concept implementation has been pushed to the following branch for TestNG based tests: main...sbrannen:TestNG-abort-in-AOT-mode
Related Issues
@DisabledInAotMode
in the TestContext framework #30834The text was updated successfully, but these errors were encountered: