一键导入
xcodebuild-testing
Run unit tests, UI tests, or specific test cases for VivaDicta using xcodebuild command-line tool
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run unit tests, UI tests, or specific test cases for VivaDicta using xcodebuild command-line tool
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run an ASO audit on canonical App Store metadata under `./metadata`, then a krankie-based competitor keyword-gap analysis (no Astro subscription). Krankie replacement for asc-aso-audit. Use after `asc metadata pull`.
Pull VivaDicta App Store keyword rankings via krankie (free, self-hosted), compare against the previous check, and write a dated rankings report to the Obsidian vault. Krankie-based replacement for asc-aso-rankings (no Astro subscription required).
Prepare a new VivaDicta release — version bump, What's New screen, App Store metadata, code sweep, and pre-submission checklist
Measure VivaDicta test code coverage from the terminal. Use when asked what the test coverage is, a module's or the whole-app coverage %, which lines/files are covered, to get coverage without opening Xcode, or to see coverage after writing tests. Covers both the fast per-SPM-module path (swift test + llvm-cov) and the canonical whole-app path (xcodebuild + xccov), and which first-party targets count.
Count Swift lines of code across the VivaDicta codebase and refresh the production-vs-test history chart. Use when asked how many LOC / lines of code the project has, for a codebase-size or LOC breakdown by SPM module / main app / extension, how big a module or extension is, the prod-vs-test ratio, or to update / regenerate the LOC growth chart embedded in documentation/Module-Architecture.md.
Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.
| name | xcodebuild-testing |
| description | Run unit tests, UI tests, or specific test cases for VivaDicta using xcodebuild command-line tool |
Use this skill when you need to run unit tests, UI tests, or specific test cases for the VivaDicta iOS app using xcodebuild command-line tool.
ios-log-capture for capturing logs during test executionaxe-simulator-control for automating simulator interactions during UI testsscreenshot for capturing screenshots during test failuresxcodebuild test command (not XcodeBuildMCP)xcsift (or xcbeautify) for readable formatting./VivaDicta.xcodeproj/project.xcworkspaceVivaDictaRun All Tests if:
→ Continue with Path A: Run All Tests (step 2A)
Run Specific Test if:
→ Continue with Path B: Run Specific Test (steps 2B-3B)
Run Test Class if:
→ Continue with Path C: Run Test Class (steps 2C-3C)
Run with Log Capture if:
→ Continue with Path D: Run with Log Capture (steps 2D-4D)
# Run all tests in the VivaDicta scheme
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test 2>&1 | xcsift
# Alternative: Save test results to file
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test 2>&1 | tee test_results.txt 2>&1 | xcsift
Available parameters:
-scheme: Xcode scheme to build and test (VivaDicta)-configuration: Build configuration (Debug or Release)-workspace: Path to workspace file-destination: Simulator or device to run tests ontest: The xcodebuild action to run testsNotes:
xcsift formats the output for better readability (alternatively xcbeautify)tee allows saving output to file while still displaying it-parallel-testing-enabled NO)You need three pieces of information:
VivaDictaTests or VivaDictaUITests# Example test identifier format:
# VivaDictaTests/TranscriptionManagerTests/testWhisperKitTranscription
# ^target ^class ^method
Finding test names:
# List all test classes and methods
xcodebuild -scheme VivaDicta \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -dry-run 2>&1 | grep "Test Case" 2>&1 | xcsift
# Or search in test files
find . -name "*Tests.swift" -exec grep -H "func test" {} \;
# Run a single test method
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -only-testing:VivaDictaTests/TranscriptionManagerTests/testWhisperKitTranscription 2>&1 | xcsift
# Run multiple specific tests
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test \
-only-testing:VivaDictaTests/TranscriptionManagerTests/testWhisperKitTranscription \
-only-testing:VivaDictaTests/TranscriptionManagerTests/testParakeetTranscription 2>&1 | xcsift
Parameters:
-only-testing:<Target>/<Class>/<Method> - Specifies exact test to run-only-testing flags to run specific testsNotes:
# Find test classes in the project
find . -name "*Tests.swift" | sed 's/.*\///' | sed 's/.swift//'
# Example output:
# TranscriptionManagerTests
# WhisperKitServiceTests
# AIServiceTests
# Run all tests in a specific test class
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -only-testing:VivaDictaTests/TranscriptionManagerTests 2>&1 | xcsift
# Run multiple test classes
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test \
-only-testing:VivaDictaTests/TranscriptionManagerTests \
-only-testing:VivaDictaTests/AIServiceTests 2>&1 | xcsift
Notes:
-only-testing:<Target>/<Class>Start log capture using the start-logs skill. See ios-log-capture for the full logging workflow.
This will:
logs/sim-YYYYMMDD-HHMMSS.log# Run tests while logs are being captured
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test 2>&1 | xcsift
Stop capture with the stop-logs skill.
Useful follow-up filters:
stop-logs errorsstop-logs warningsManual analysis remains the same:
grep -i "error\\|fail\\|crash" logs/sim-*.log
grep "test" logs/sim-*.log
# Run specific test you're working on
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -only-testing:VivaDictaTests/MyFeatureTests/testNewFeature 2>&1 | xcsift
# Run all tests and save results
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test 2>&1 | tee logs/test_results_$(date +%Y%m%d_%H%M%S).txt 2>&1 | xcsift
# Check exit code
echo "Test exit code: $?"
# List available simulators
xcrun simctl list devices available
# Run on specific simulator
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5' \
test 2>&1 | xcsift
# After a test run fails, rerun only failed tests
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -only-testing:VivaDictaTests/FailedTestClass/testThatFailed 2>&1 | xcsift
# Enable parallel testing (default)
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -parallel-testing-enabled YES 2>&1 | xcsift
# Disable parallel testing (for debugging race conditions)
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -parallel-testing-enabled NO 2>&1 | xcsift
# Run tests with code coverage enabled
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -enableCodeCoverage YES 2>&1 | xcsift
# View coverage report location
# DerivedData/<project>/Logs/Test/*.xcresult
# 1. Run tests and note which test fails
xcodebuild -scheme VivaDicta \
-configuration Debug \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=26.4' \
test -only-testing:VivaDictaTests/UITests/testLoginFlow 2>&1 | xcsift
# 2. If test fails, capture screenshot using xcrun simctl
xcrun simctl io booted screenshot logs/test_failure_$(date +%Y%m%d_%H%M%S).png
"Testing failed" with no clear error:
xcrun simctl list | grep Bootedxcodebuild -listxcodebuild clean then retry"Unable to boot device" error:
xcrun simctl shutdown all then retryxcrun simctl list devicesTests hang or timeout:
-parallel-testing-enabled NO"Test target not found" error:
xcodebuild -listxcsift not found:
brew install xcsift (or use xcbeautify as alternative: brew install xcbeautify)2>&1 | xcsift from command)Specific test not found:
test prefixfunc test...() not private-dry-run to see all available testsSimulator wrong OS version:
xcrun simctl list runtimesUse xcsift for readable output:
xcsift for formatted output (project standard)brew install xcsift (or xcbeautify as alternative)Run specific tests during development:
-only-testing for TDD workflowSave test results for analysis:
tee to save output while viewing itlogs/ directory (gitignored)Combine with log capture for debugging:
Use consistent simulator:
Clean build when tests behave unexpectedly:
xcodebuild clean -scheme VivaDicta \
-workspace ./VivaDicta.xcodeproj/project.xcworkspace
Check exit codes in scripts:
xcodebuild ... test 2>&1 | xcsift
if [ $? -ne 0 ]; then
echo "Tests failed!"
exit 1
fi
Organize test output:
mkdir -p logs/test-results
xcodebuild ... test 2>&1 | tee logs/test-results/run_$(date +%Y%m%d_%H%M%S).txt 2>&1 | xcsift
Use test plans for different configurations:
-testPlan <name> flagMonitor test execution time:
-result-bundle-path to save detailed results.xcresult bundles for performance insights