Skip to content

Fix #74: map test items by real class FQN, not filesystem path - #76

Merged
gjsjohnmurray merged 2 commits into
intersystems-community:mainfrom
globalerp-mhess:fix-74
Jun 18, 2026
Merged

gjsjohnmurray merged 2 commits into
intersystems-community:mainfrom
globalerp-mhess:fix-74

Conversation

@globalerp-mhess

Copy link
Copy Markdown
Contributor

Fixes #74.

What

Two related symptoms, both rooted in the test-item id being derived from the filesystem path under relativeTestRoot instead of from the compiled class FQN:

  • Class-level lookup in DebugTracker. The tracker built its method-item lookup key from the FQN that %UnitTest.Manager writes to stdout, while the test-item ids were path-based. When the two diverge (any relativeTestRoot that doesn't mirror the package hierarchy), the lookup returned undefined, run.passed/failed/skipped() was never called, and the UI defaulted everything to "skipped".
  • Single-method testspec in commonRunTestsHandler. The same path-derived id part was reused as the testcase argument of %UnitTest.Manager.RunTest(). The manager could not find a matching class and produced no per-method result, so single-method runs returned nothing either.

How

A small extra property ourFqn on OurTestItem, populated from the Class … line while resolving the .cls file. Both call sites prefer this FQN and fall back to the previous path-derived value when no FQN was parsed.

Verification

Reproduced both symptoms on Windows / IRIS 2025.1.3 with relativeTestRoot set to a directory deeper than the class package root. After the patch:

  • Class-level: every method transitions to passed/failed correctly in the UI.
  • Single-method: right-click → Run Test on an individual Test… method produces the expected outcome.

Commits are split for review: first one wires up the data, second one consumes it in both places.

Read the fully-qualified class name from the `Class …` line of every
test class while resolving its children, and store it as `ourFqn` on
the test item. This decouples the real class identity from the
filesystem path under `relativeTestRoot`, which is needed to map the
%UnitTest.Manager output back to test items and to build a correct
testspec for single-method runs (see intersystems-community#74 for the symptoms).
…s-community#74)

When the filesystem layout under `relativeTestRoot` does not mirror the
package hierarchy of the test classes, the previous code derived a
"class name" from the relative path that diverges from the real
compiled FQN written by %UnitTest.Manager. Two consequences:

* DebugTracker built its method-item lookup key from the FQN reported
  in stdout but the test-item ids were path-based, so the lookup
  returned undefined and run.passed/failed/skipped was never called —
  every method stayed on "skipped" in the UI.
* commonRunTestsHandler reused the same path-based id part as the
  testcase argument of %UnitTest.Manager.RunTest() for single-method
  runs, so the manager could not find the class and produced no
  per-method result.

Both call sites now prefer the real FQN from OurTestItem.ourFqn (with
the previous behaviour as a fallback when no FQN was parsed).

@gjsjohnmurray gjsjohnmurray left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Thanks for contributing.

@gjsjohnmurray
gjsjohnmurray merged commit 1ff5447 into intersystems-community:main Jun 18, 2026
5 checks passed
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 this pull request may close these issues.

Local test methods reported as skipped when test class FQN does not match path under relativeTestRoot

2 participants