analyze-selective-testing
Skill này làm gì
Skill này phân tích các lần chạy test Xcode trong Tuist để xem target test nào đã bị bỏ qua hoặc đã chạy. Skill dành cho lập trình viên iOS và macOS muốn chạy test nhanh hơn mà không bỏ sót test nào.
Khi nào nên dùng
- ✓Khi bạn muốn biết Xcode đã bỏ qua những target test nào trong một lần chạy test.
- ✓Khi việc chọn test có vẻ tệ đi và bạn muốn tìm nguyên nhân.
- ✓Khi bạn muốn so sánh hai lần chạy test để xem điều gì đã thay đổi.
Liên kết skill
https://github.com/tuist/tuist/blob/main/skills/skills/analyze-selective-testing/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Kiểm tra những target test nào đã bị bỏ qua trong lần chạy test mới nhất trên nhánh này và vì sao việc bỏ qua giảm đi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent liệt kê các lần chạy test gần đây bằng công cụ dòng lệnh Tuist, đọc trạng thái selective testing của từng target, rồi so sánh các lần chạy khi nghi ngờ có hồi quy.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Analyze Selective Testing
Quick Start
- Run
tuist test list --jsonto find test runs. - Run
tuist test xcode target list <test-run-id> --jsonto see per-target selective testing status. - 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:
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:
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:
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), orremote(skipped via remote cache) - hash: The selective testing hash for this target
Filter by status to focus your analysis:
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:
- Run
tuist test xcode target list <good-run-id> --jsonandtuist test xcode target list <bad-run-id> --json. - Match targets by name — identify those that changed from
local/remotetomiss. - Compare hashes for changed targets — if a target's hash differs, its sources or dependencies changed.
- 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:
- Overall: effectiveness percentage, verdict (healthy/moderate/low/cold)
- Target breakdown: targets grouped by hit status
- Comparison (if applicable): targets that changed status between runs, with hash diffs
- Root cause: what caused the regression
- 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)
Câu hỏi thường gặp
Tôi có cần Tuist không?
Có. Skill dùng công cụ dòng lệnh Tuist để đọc dữ liệu lần chạy test.
Target bị bỏ qua nghĩa là gì?
Nghĩa là target không được chạy vì không thay đổi, dựa trên cache cục bộ hoặc cache từ xa.
Skill có so sánh hai lần chạy không?
Có. Skill có thể so sánh một lần chạy tốt đã biết với một lần bị hồi quy.
Chi tiết
Mô tả gốc của tác giả
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.
repo: tuist/tuist
Độ phổ biến
- Sao GitHub
- 5.9k
- Vị trí xếp hạng
- #14536
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
compare-builds
5.9kGiúp agent của bạn so sánh hai lần build Xcode để tìm các build chậm hơn, thay đổi trong việc dùng cache và các vấn đề mới.
compare-bundles
5.9kGiúp agent của bạn so sánh hai bundle ứng dụng để tìm thay đổi về kích thước, các file được thêm hoặc xóa và khác biệt giữa các nền tảng.
compare-cache-runs
5.9kGiúp agent của bạn so sánh hai lần chạy cache để tìm thay đổi về tỷ lệ cache hit và giải thích vì sao cache bị vô hiệu hóa.
compare-generations
5.9kGiúp agent của bạn so sánh hai lần tạo project Tuist để tìm thay đổi về cache hit và nguyên nhân cache bị vô hiệu hóa.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.