Skip to content

[SDTEST-3795] Fix nested Swift Testing @Suite crash#253

Merged
ypopovych merged 3 commits into
mainfrom
sdtest-3795-nested-swift-testing-suites
May 15, 2026
Merged

[SDTEST-3795] Fix nested Swift Testing @Suite crash#253
ypopovych merged 3 commits into
mainfrom
sdtest-3795-nested-swift-testing-suites

Conversation

@ypopovych

@ypopovych ypopovych commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes SDTEST-3795 / issue #252: nested @Suite types crashed when .datadogTesting was applied, because the trait keyed tests by the outermost type only while suite registration used the innermost, so the inner suite ran tests it had never been told about.
  • Testing.Test.ddSuite now joins the full enclosing-type chain (e.g. Outer.Inner) so the registry, function-lines lookup, and span tags all agree on one identifier per suite.
  • Module name is normalized by replacing _ with - in both the Swift Testing (ddModule) and XCTest (bundleName) paths, so the same bundle yields a single Module instance no matter which framework reaches module(named:) first.
  • Suite.internalEnd skips test_suite_end emission when no tests started in that suite — container types that only enclose nested @Suites and the XCTest wrapper-suite no longer generate empty suite events.

Test plan

  • DDSuiteNamingTests — new unit tests assert ddSuite returns the full dotted chain for top-level, single-nested, and doubly-nested suites.
  • ObserverTesterTrait now keys its expected dictionary by suite-qualified test name to avoid collisions across nested suites.
  • nestedSuitePass integration test (IntegrationTests-UnitTests) asserts: one test_suite_end (STNestedSuite.Inner), one test_module_end, one test_session_end.
  • FileLocator fixture coverage already includes dotted-module symbols (Mocks.TestBase.set(skipped:)), so nested-type symbol lookup works without further changes.
  • Run the full unit + integration suites across all platforms before merge.

🤖 Generated with Claude Code

Nested @suite types crashed when `.datadogTesting` was applied. Build the
suite identifier from the full enclosing-type chain (e.g. `Outer.Inner`),
gate suite_end emission on whether any tests ran inside, and normalize the
module name (`_` → `-`) so XCTest and Swift Testing converge on the same
Module instance for a given bundle.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@ypopovych
ypopovych requested review from a team as code owners May 15, 2026 11:35
Verifies the function-lines lookup resolves nested-type symbols
(`STNestedSuite.Inner.nestedPass()`) into the suite-qualified key
used by `AdditionalTagsFeature`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@ypopovych
ypopovych requested a review from calvinbayer May 15, 2026 11:39
@ypopovych
ypopovych merged commit 4f9f72f into main May 15, 2026
57 of 61 checks passed
@ypopovych
ypopovych deleted the sdtest-3795-nested-swift-testing-suites branch May 15, 2026 13:32
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.

2 participants