bazel-contrib / bazel-contrib/rules_jvm

BazelJUnitOutputListener Can't Handle Deeply Nested Test Classes

Open
#296 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
54
Forks
98
Avg merge
6d 2h
Merged PRs (30d)
7

Description

It seems that the `BazelJUnitOutputListener` class can handle only up to 4 jupiter `@Nested` classes for simple tests. This is because with no nesting, there are 3 segments, and since (1) each nested class adds another segment to `uniqueId`, and (2) the `matchTestCasesToSuites_locked` method can handle up to [6 nested classes](https://github.com/bazel-contrib/rules_jvm/blob/e0d10b4420a0d1efc6a0aafc124453a5bceb27c8/java/src/com/github/bazel_contrib/contrib_rules_jvm/junit5/BazelJUnitOutputListener.java#L102-L111), the method silently handles nested classes until you hit 4, in which case I get the following error:

```
WARNING: Unexpected test organization for TestIdentifier
[uniqueId = [engine:junit-jupiter]/
[class:]/
[nested-class:]/
[nested-class:]/
[nested-class:]/
[nested-class:]/
[method:], ...]
```

Contributor guide

Open the contributing guide

Research direction

Start in java/src/com/github/bazel_contrib/contrib_rules_jvm/junit5/BazelJUnitOutputListener.java, at the matchTestCasesToSuites_locked method linked in the issue. Reproduce the warning with a test containing four or more Jupiter @Nested classes, then verify that deeply nested TestIdentifier values are handled without the unexpected-organization warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.