-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
TestReporter does not capture the correct TestIdentifier when used with DynamicTests #393
Comments
Yes, found those issues after posting this. Thanks. Sorry about the duplication. |
No worries! The use of a |
One simple solution would be to save the dynamicTest's TestIdentifier in a variable of the TestExecutionListener when the testExecutionStarted lifecycle method kicks and use that instead of the TestIdentifier supplied in the arguments of reportEntryPublished. So, for example, supposing that your dynamic test has access to the TestFactory's TestReport and use it to publishEntries:
|
Here's another workaround: #4175 (reply in thread) |
Duplicate of #378 |
I'm investigating JUnit5 for a project, and I find the concept of
TestFactory
andDynamicTests
interesting for our use case. During the execution of aDynamicTest
, I would also like to report some additional information for that particular test, so I added aTestReporter
parameter to theTestFactory
method:Using a
TestExecutionListener
, I can see that theReportEntry
s are published, but they are all associated with the wrongTestIdentifier
. Quite obvious, when thinking about it, since theTestReporter
, once injected, is associated with theExtensionContext
it was assigned when it was created.So it does not seem to be possible to use a
TestReporter
in conjunction withDynamicTest
this way. Is it possible to achieve this some other way? Since theTestExecutionListener
reports the correctTestIdentifier
for lifecycle events (e.g.executionFinished
) for the otherDynamicTest
s, it seems like it should be possible somehow to dynamically assign the correct context to aTestReporter
.Related Issues
The text was updated successfully, but these errors were encountered: