swift-testing

Solid

Swift testing: XCTest, Swift Testing framework, async patterns.

Testing & QA 392 stars 36 forks Updated today MIT

Install

View on GitHub

Quality Score: 94/100

Stars 20%
86
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Swift Testing Patterns ## XCTest Basics XCTest is Apple's foundational testing framework. Every test class inherits from `XCTestCase` and uses `setUp`/`tearDown` for lifecycle management. ```swift import XCTest @testable import MyApp final class UserServiceTests: XCTestCase { var sut: UserService! var mockStore: MockUserStore! override func setUp() { super.setUp() mockStore = MockUserStore() sut = UserService(store: mockStore) } override func tearDown() { sut = nil mockStore = nil super.tearDown() } func testFetchUser_withValidID_returnsUser() { mockStore.stubbedUser = User(id: "1", name: "Alice") let user = sut.fetchUser(id: "1") XCTAssertNotNil(user) XCTAssertEqual(user?.name, "Alice") } func testFetchUser_withInvalidID_returnsNil() { mockStore.stubbedUser = nil let user = sut.fetchUser(id: "unknown") XCTAssertNil(user) } } ``` ## Swift Testing Framework (Swift 5.9+) The Swift Testing framework replaces XCTest with a more expressive, macro-driven approach. Use `@Test` for individual tests, `#expect` for assertions, and `@Suite` for grouping. ```swift import Testing @testable import MyApp @Suite("User Service") struct UserServiceTests { let mockStore = MockUserStore() @Test("fetches user by valid ID") func fetchValidUser() { mockStore.stubbedUser = User(id: "1", name: "Alice") let servic...

Details

Author
notque
Repository
notque/vexjoy-agent
Created
2 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Listed

swift-testing

Write and migrate tests using the Swift Testing framework with @Test, @Suite, #expect, #require, confirmation, parameterized tests, test tags, traits, withKnownIssue, XCTest UI testing, XCUITest, test plan, mocking, test doubles, testable architecture, snapshot testing, async test patterns, test organization, and test-driven development in Swift. Use when writing or migrating tests with Swift Testing framework, implementing parameterized tests, working with test traits, converting XCTest to Swift Testing, or setting up test organization and mocking patterns.

661 Updated 4 days ago
dpearson2699
Testing & QA Listed

ios-testing

iOS testing expert skill covering Swift Testing framework (@Test, #expect, #require, @Suite, parameterized tests, traits), XCTest (assertions, async testing, performance testing, XCTestExpectation), UI Testing (XCUIApplication, XCUIElement, Page Object pattern, accessibility identifiers), snapshot testing (swift-snapshot-testing), mocking strategies (protocol-based mocks, URLProtocol for network, test doubles), and testing patterns for SwiftUI, SwiftData, Combine, and async/await code. Use this skill whenever the user writes tests, creates test classes, needs mocking strategies, or asks about testing iOS code. Triggers on: test, @Test, #expect, XCTest, XCTestCase, unit test, UI test, integration test, mock, stub, spy, fake, snapshot test, test coverage, TDD, testing, assert, XCTAssert, Swift Testing, @Suite, parameterized test, test plan, test double, URLProtocol mock, ViewInspector, or any iOS testing question.

0 Updated today
ebbaunqualified520
Testing & QA Solid

swift-testing-expert

Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.

398 Updated 1 months ago
AvdLee
Testing & QA Listed

swift-testing-expert

Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.

0 Updated today
jajaaa2
Testing & QA Listed

testing-patterns

Backend testing patterns with JUnit 6, Mockito 6, Testcontainers 2.0, Spring Boot slice tests, RestTestClient, and security testing. Use when user mentions testing, coverage, TDD, integration tests, or "write tests for".

0 Updated today
IuliaIvanaPatras