analyze-selective-testing
Analyzes Xcode selective testing effectiveness for a test run, showing which test targets were skipped or ran, and diagnosing regressions in test selection. Can compare two test runs to identify what changed.
What this skill does
# Analyze Selective Testing ## Quick Start 1. Run `tuist test list --json` to find test runs. 2. Run `tuist test xcode target list <test-run-id> --json` to see per-target selective testing status. 3. If effectiveness dropped, compare targets between a known-good run and the regressed run. ## Step 1: Resolve Test Runs ### Find the test run to analyze List recent test runs, optionally filtering by branch: ```bash tuist test list --json --page-size 10 tuist test list --git-branch feature-x --json --page-size 5 ``` Get basic info for a specific test run: ```bash tuist test show <test-run-id> --json ``` Use this to confirm the run's branch, status, scheme, and environment (`xcode_version`, `macos_version`). ### Defaults - If no test run is specified, use the most recent CI test run on the current branch. - For comparison, use the most recent CI test run on the project's default branch. ## Step 2: Drill Into Selective Testing Targets List per-target selective testing data for a test run: ```bash tuist test xcode target list <test-run-id> --json ``` Each target includes: - **name**: The test target name - **hit_status**: `miss` (ran), `local` (skipped via local cache), or `remote` (skipped via remote cache) - **hash**: The selective testing hash for this target Filter by status to focus your analysis: ```bash tuist test xcode target list <test-run-id> --hit-status miss --json tuist test xcode target list <test-run-id> --hit-status local --json tuist test xcode target list <test-run-id> --hit-status remote --json ``` ### Assess effectiveness Count the targets by status: ``` effectiveness = (local_hits + remote_hits) / total_targets * 100 ``` | Effectiveness | Verdict | |---|---| | 60-100% | Healthy — most unchanged tests are being skipped | | 30-60% | Moderate — some cache invalidation occurring, worth investigating | | 0-30% | Low — likely a core dependency changed or the cache was invalidated | | 0% | Cold cache — first run, environment change, or full invalidation | ## Step 3: Diagnose Regressions If effectiveness dropped, investigate: ### Check for global invalidation If nearly all targets show as `miss`, the entire selective testing cache was invalidated. Common causes: | Cause | How to verify | |---|---| | Xcode version change | Compare `xcode_version` between good and bad runs via `tuist test show` | | CI environment change | Compare `macos_version`, `model_identifier` between runs | | Project graph or dependency change | Check git history for changes to project manifests, dependency versions, or target configurations | | Core dependency change | A widely-depended-on target changed, invalidating all its dependents | Note: Tuist CLI version upgrades rarely cause hash invalidation — the hash version is not updated on every release. ### Check for cascade invalidation If only some targets show as `miss`, a dependency change likely cascaded: 1. Run `tuist test xcode target list <good-run-id> --json` and `tuist test xcode target list <bad-run-id> --json`. 2. Match targets by name — identify those that changed from `local`/`remote` to `miss`. 3. Compare hashes for changed targets — if a target's hash differs, its sources or dependencies changed. 4. Look for a common dependency among the invalidated targets. ### Compare two test runs For each target: - Match by `name` - Compare `hit_status` (hit -> miss = invalidated, miss -> hit = improved) - Compare `hash` (different hash = target or its dependencies changed) ## Step 4: Recommendations Based on the diagnosis: - **Environment change**: Ensure CI uses consistent Xcode/macOS versions. This is the most common cause of full cache invalidation. - **Cascade from dependency change**: Consider if the change to the root target was necessary. If the root target is a widely-shared module, consider splitting it. - **Cold cache on new branch**: Run tests once to warm the cache. Subsequent runs will benefit from selective testing. ## Summary Format Produce a summary with: 1. **Overall**: effectiveness percentage, verdict (healthy/moderate/low/cold) 2. **Target breakdown**: targets grouped by hit status 3. **Comparison** (if applicable): targets that changed status between runs, with hash diffs 4. **Root cause**: what caused the regression 5. **Recommendations**: actionable next steps Example: ``` Selective Testing Analysis: test run abc123 on feature-x Effectiveness: 15% (3/20 targets skipped) -- LOW Local hits: 2 targets (CoreTests, UtilTests) Remote hits: 1 target (NetworkTests) Misses: 17 targets Comparison with baseline (run def456, 75% effectiveness): 14 targets changed from hit to miss All changed targets have different hashes Root cause: Xcode version changed from 15.2 to 16.0 between runs. This changed all target hashes, invalidating the entire cache. Recommendations: - Align CI Xcode version with the version used in the baseline run. - If the upgrade is intentional, run tests once to re-warm the cache. ``` ## Done Checklist - Identified the test run(s) to analyze - Drilled into per-target selective testing status via `tuist test xcode target list` - Diagnosed root cause if effectiveness is low - Compared targets with baseline if regression detected - Provided actionable recommendations
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.