cmux-testing

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

cmux testing rules for Swift Testing, test target compilation, test wiring, and package/refactor validation. Use when adding or changing tests, touching package/refactor code, or deciding whether reload.sh is enough validation.

skills/cmux-testing/SKILL.md

Download bundle ↓
main · 6f118af6 bundle filesScanned 2026-09-15

references/swift-testing-migration.md

370 tokens · o200k_base · 1,402 bytes

Swift Testing Migration

Swift Testing for unit and integration tests; XCTest stays for UI tests under cmuxUITests/ (Swift Testing has no XCUIApplication support).

New tests

import Testing

@Suite
struct ExampleTests {
    @Test
    func computesValue() {
        #expect(1 + 1 == 2)
    }
}

Use try #require(...) when a value must be unwrapped before continuing.

XCTest conversion mapping

Convert in place only when an edit naturally crosses the file; do not bulk-rewrite untouched tests.

XCTestSwift Testing
XCTestCase subclass@Suite struct (or @Suite final class for a reference type)
func testFoo()@Test func foo()
XCTAssertEqual(a, b)#expect(a == b)
XCTAssertTrue(cond)#expect(cond)
XCTUnwrap(x)try #require(x)
XCTFail("msg")Issue.record("msg")
setUp()init() (async setup: async init())
tearDown()deinit

Parameterized tests

@Test(arguments: [
    ("input-a", "output-a"),
    ("input-b", "output-b"),
])
func formats(input: String, expected: String) {
    #expect(format(input) == expected)
}

Parallel execution

Tests run in parallel by default, including across suites. Prefer isolated temp directories and injected dependencies; use @Suite(.serialized) only when a suite genuinely needs ordering or guards shared mutable state.

Referenced from SKILL.md