Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

@DisplayNameGeneration is not discovered on runtime enclosing type for @Nested test class #4131

Open
2 tasks
sbrannen opened this issue Nov 15, 2024 · 3 comments

Comments

@sbrannen
Copy link
Member

sbrannen commented Nov 15, 2024

Overview

@DisplayNameGeneration is currently discovered on the current test, a superclass, or the enclosing class in which a Nested test class is declared. However, the runtime type of an enclosing instance is not always the class in which a @Nested test class is declared.

Example

The examples here are copies of those in #4130 except that @IndicativeSentencesGeneration has been moved from AbstractBaseTests to ScenarioOneTests.

abstract class AbstractBaseTests {

	@Nested
	class NestedTests {

		@Test
		void test() {
		}
	}
}
@IndicativeSentencesGeneration
class ScenarioOneTests extends AbstractBaseTests {
}

Actual Behavior

When running ScenarioOneTests, we currently see the following display names, since @IndicativeSentencesGeneration is not honored (i.e., the @DisplayNameGeneration(IndicativeSentences.class) meta-annotation is not discovered).

  • ScenarioOneTests
    • NestedTests
      • test()

Expected Behavior

When running ScenarioOneTests, we would expect the following display names before #4130 is resolved.

  • ScenarioOneTests
    • AbstractBaseTests, NestedTests
      • AbstractBaseTests, NestedTests, test()

When running ScenarioOneTests, we would expect the following display names after #4130 is resolved.

  • ScenarioOneTests
    • ScenarioOneTests, NestedTests
      • ScenarioOneTests, NestedTests, test()

Related Issues

Deliverables

  • Determine if it is possible to support this use case
  • If it is possible, ensure that @DisplayNameGeneration is discovered on the runtime enclosing type for a @Nested test class.
@marcphilipp
Copy link
Member

Team decision: Investigate feasibility after #4130 has been addressed.

@abdelmawla56
Copy link

hello @sbrannen, I would love to work on this issue, would you please assign it to me?
it will be solved by adding somethings

@marcphilipp
Copy link
Member

@abdelmawla56 I'd be happy to but #4130 should be done first because we think there'll be a large overlap. That's why this issue is currently labeled as "blocked".

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants