swift-testing-conventions
Testing conventions for Swift/SwiftUI projects using Clean Architecture. Covers Swift Testing framework for unit/integration tests, XCUITest for UI and E2E tests, manual protocol-based mocking, async testing patterns, and test organization. Use when writing tests, reviewing test code, setting up test infrastructure, or discussing testing strategy in Swift projects.
Security Assessment
About swift-testing-conventions
The 'swift-testing-conventions' skill provides a comprehensive guide to testing conventions specifically tailored for Swift and SwiftUI projects using Clean Architecture. It addresses the complexities of unit, integration, UI, and end-to-end (E2E) testing while ensuring efficient organization and maintainable testing practices. This skill guides developers through testing with the Swift Testing framework, leveraging XCUITest for UI and E2E tests, manual protocol-based mocking, and asynchronous testing patterns, offering a robust solution to ensure code quality and reliability in Swift applications.
FAQ
How do I use this skill in a Swift project?
This skill is ideal for organizing and structuring tests in Swift projects. It provides conventions for unit, integration, UI, and E2E testing, as well as naming conventions, file organization, and specific testing patterns for Swift/SwiftUI apps with Clean Architecture.
Does this skill support XCTest for Swift testing?
Yes, this skill is based on the Swift Testing framework, which is closely integrated with XCTest. It supports various types of tests, including unit, integration, and UI tests using XCUITest.
Is this skill compatible with other testing frameworks?
This skill focuses on Swift and SwiftUI projects using the Swift Testing framework and XCUITest. While it primarily emphasizes these tools, its conventions and best practices can be adapted for other testing frameworks with similar functionality.
What is the recommended structure for organizing tests in a Swift project?
Tests should be organized into clear directories like 'domainTests' for domain-related tests and '{app}Tests' for application-specific tests. The organization is based on Clean Architecture principles, with separate directories for entities, use cases, view models, and UI tests.
What are the FIRST principles and how should I apply them in my tests?
The FIRST principles emphasize writing fast, independent, repeatable, self-validating, and timely tests. Unit tests should be fast (<100ms), have no shared state, and produce the same result every time. Tests should be written before production code and pass without manual inspection.
Install swift-testing-conventions
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
benaor/claude-config