swift-unit-tests
How to run swift unit tests
When & Why to Use This Skill
This Claude skill provides a comprehensive guide and automated workflow for executing Swift unit tests using command-line tools. It streamlines the process of identifying available iOS simulators, selecting the most appropriate device (such as the latest iPhone Pro models), and running test suites via xcodebuild. By leveraging this skill, developers can ensure high code quality and maintain robust testing standards within their iOS development environment.
Use Cases
- Automated Local Testing: Quickly execute unit tests from the terminal to verify code changes without the overhead of the Xcode GUI.
- CI/CD Pipeline Integration: Use the provided command structures to automate Swift testing in continuous integration workflows, ensuring every pull request meets quality benchmarks.
- Simulator Management: Efficiently list and identify booted or available iOS simulators to optimize the testing environment on a local machine.
- Regression Testing: Run specific schemes and projects against the latest iOS simulator versions to detect regressions early in the development lifecycle.
| name | swift-unit-tests |
|---|---|
| description | How to run swift unit tests |
- List available simulators with
xcrun simctl list devices available - If one is booted already, use that. Prefer iPhone xx Pros, the latest ones
- Run the unit tests with
xcodebuild test -project YourApp.xcodeproj -scheme YourScheme -destination 'platform=iOS Simulator,name=iPhone 17 Pro'. The app is usually in the root of the directory. The simulator is the one from step 2. The scheme has to be found out