-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Extension API for registering dynamic tests #1444
Comments
Tentatively assigned to the 5.3.x backlog for team discussion |
Thanks @sbrannen |
Closely related to #371. |
Any movement on this one? I have a use case that I think I can almost implement using standard extensions points, but not quite. You guys are no doubt familiar with soft assertions in AssertJ - it collates the test failures into a single A problem we are having is dealing with the verbosity of the resulting error message, in particular if we add the stack traces to it for easy IDE navigation. I had a crazy idea - instead of collating them into a single error and reporting them all against a single test node in the test hierarchy, each of the assertions would generate a There are two main ways I could implement it. One of them is to come up with a soft proxy generator that produces a stream or collection of The alternative is to have the smarts in an extension's My proposal is quite simple: add a Thoughts? |
@vmassol, it also occurred to me that your problem could be solved with the existing API, as follows: public interface RenderingTests {
@TestFactory
default Stream<DynamicTest> renderingTests() {
return RenderingTestSuite.generateStreamOfDynamicTests();
}
}
class IntegrationTests implements RenderingTests {
...
} Hope that helps (although I see it was a long time ago... you've probably either solved it or moved on!) I still would like to push for the API to allow extensions to register dynamic tests, as I don't think my use case has a workaround using the existing API. |
@kriegfrj Yes that could be a workaround. I still consider that a workaround and I'd prefer to have a way to register dynamic tests in a JUnit Extension. That would be cleaner and nicer. Thanks for the idea! |
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. |
I'm still interested in this one. Haven't given up on the long-term AssertJ plan. Pinging @joel-costigliola, @scordio from the AssertJ team. I will raise an issue there too and link it to this one. |
I wonder if generating tests during test execution will be compatible with "restart test from IDE", "run specific test from command line", "filter tests by tag". |
This issue has been automatically closed due to inactivity. If you have a good use case for this feature, please feel free to reopen the issue. |
JUnit 5 team, it looks like the stale bot forgot to remove the "stale" label for this issue and subsequently closed it too early. Would you mind re-opening it? |
Overview
I currently have a JUnit 4 based custom
Suite
which automatically registers new tests to the JUnit runner and which allows to write very simple tests:The custom suite reads
*.test
files found in the CL's classpath and generates dynamic tests from them.I'd like to move this to JUnit 5, but I'm a bit stuck ATM since it seems the best approach would be to use some test factory or parameterized test, but this would require each of my tests to declare a test method with something like:
I'd really like my tests to remain as simple as the following (and this without duplication):
PS: I've also asked the question on Gitter (which contains additional details).
Related Issues
The text was updated successfully, but these errors were encountered: