.claude/skills/running-tests/SKILL.md
Use when asked to run tests in the dd-sdk-ios project — whether a full module suite, a specific test class, or a single test method. Use when choosing between make, xcodebuild, or Xcode MCP for running iOS/tvOS/visionOS tests.
npx skillsauth add DataDog/dd-sdk-ios dd-sdk-ios:running-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use make to replicate CI exactly. Always prefer this for running a full module or all modules.
Before running: verify available simulators and pick an appropriate device name:
xcrun simctl list devices available | grep -E "iPhone|Apple TV"
| Goal | Command |
|------|---------|
| All iOS unit tests | make test-ios-all |
| One module | make test-ios SCHEME="<Scheme>" |
| One module with specific device | make test-ios SCHEME="<Scheme>" DEVICE="<Device>" |
| All tvOS unit tests | make test-tvos-all |
| UI / integration tests | make ui-test TEST_PLAN="<Plan>" |
| Session Replay snapshots | make sr-snapshot-test |
Default devices (authoritative values from Makefile):
grep "DEFAULT_" Makefile
Always pass DEVICE= explicitly if the default simulator is not installed locally. Check xcrun simctl list devices available first.
Module scheme names: Always read the Makefile to get the authoritative list — it changes as modules are added or renamed:
grep "test-ios-all" Makefile -A 20 # shows all iOS schemes used in CI
Requires Xcode 26.3+ with the Xcode MCP server enabled in Claude Code settings.
Before using Xcode MCP, verify the setup:
xcodebuild -version
XcodeListWindows is availableXcodeListWindows is unavailable → ask the user to enable the Xcode MCP server in Xcode settingsRunSomeTests is limited to targets in the currently active Xcode scheme. The MCP has no tool to switch schemes — that must be done manually in Xcode.
Get the tabIdentifier (identifies the open Xcode workspace window):
XcodeListWindows() # → tabIdentifier e.g. "windowtab1"
Check available targets first:
GetTestList(tabIdentifier: <tabIdentifier>)
# → lists targets in the active scheme only
If the test is in the active scheme, run it directly:
RunSomeTests(
tabIdentifier: <tabIdentifier>,
tests: [{
targetName: "<targetName from GetTestList>",
testIdentifier: "<TestClass>/<testMethod>()"
}]
)
If the test is NOT in the active scheme, use xcodebuild -only-testing:
xcodebuild test \
-workspace Datadog.xcworkspace \
-scheme "<Module> <Platform>" \
-destination 'platform=<Platform> Simulator,name=<Device>' \
-only-testing:<TargetName>/<TestClass>/<testMethod>
To find which module owns a test:
XcodeGrep(tabIdentifier: <tabIdentifier>, pattern: "func <testName>", outputMode: "filesWithMatches")
# path reveals the module: DatadogInternal/Tests/... → scheme "DatadogInternal iOS"
Need to run tests?
├── Full module or CI replication?
│ └── make test-ios SCHEME="<Module> iOS" DEVICE="<Device>"
└── Specific class or method?
├── Test is in the active Xcode scheme? (check GetTestList)
│ └── RunSomeTests
└── Test is in a different scheme?
└── xcodebuild -only-testing (or ask user to switch scheme in Xcode)
| Mistake | Fix |
|---------|-----|
| Assuming RunSomeTests works for any module | It only sees targets in the active Xcode scheme — MCP cannot switch schemes |
| Not knowing which scheme owns the test | Grep for the function — file path reveals the module |
| Running full module when only one test needed | Use RunSomeTests or xcodebuild -only-testing |
| Running integration tests under feature module scheme | Integration tests use target DatadogIntegrationTests iOS/tvOS |
development
Use when adding, removing, moving, or renaming Swift source files in the dd-sdk-ios Xcode project. Use when the task involves file creation, deletion, or relocation in any module (DatadogRUM, DatadogLogs, DatadogCore, etc.). Use when you would otherwise reach for Write, Bash mv/mkdir/rm, or manual pbxproj editing for file management.
development
Use when creating a pull request in dd-sdk-ios. Use when writing PR titles, PR body, or choosing the target branch.
development
Use when committing changes in dd-sdk-ios. Use when writing commit messages, signing commits, or staging files before a commit.
development
Use when creating a new branch in dd-sdk-ios for a JIRA ticket or feature. Use when choosing a branch name or base branch for development work.