Skip to content
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

BazelJUnitOutputListener doesn't log methodName for @ParameterizedTest #319

Open
amishra-u opened this issue Jan 30, 2025 · 0 comments · May be fixed by #325
Open

BazelJUnitOutputListener doesn't log methodName for @ParameterizedTest #319

amishra-u opened this issue Jan 30, 2025 · 0 comments · May be fixed by #325

Comments

@amishra-u
Copy link
Contributor

amishra-u commented Jan 30, 2025

How to reproduce?

  1. Run any @parameterized test inside rules_jvm package.
  2. Check the generated text.xml file, the name in test case only contains index of the test and ignores the method name.

Sample result test in MixedTest.java file

Expected

expected name to contain testMethodName and index

<testcase name="bootstrap[1] goGreek=alpha" classname="com.github.bazel_contrib.contrib_rules_jvm.comparative.MixedTest" time="0.03">

Actual

But test name only contains index

<testcase name="[1] goGreek=alpha" classname="com.github.bazel_contrib.contrib_rules_jvm.comparative.MixedTest" time="0.03">

Issue

JUnit5 internally treats @ParameterizedTest as a specialized form of a test template, storing it as an instance of TestTemplateTestDescriptor in the DiscoveryResult. For execution, TestTemplateTestDescriptor leverages DynamicTestExecutor, which triggers the dynamicTestRegistered method on registered listeners. As a result, BazelJUnitOutputListener incorrectly classifies ParameterizedTest as a dynamic test.

@amishra-u amishra-u linked a pull request Mar 1, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant