协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
swift-testing【开发与工程】Write XCTest cases, async tests, and organized test suites in Swift. Use when writing XCTest cases, async tests, or organizing test suites in Swift.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
[MOB-TEST-01] Tripartite Naming: Test functions must follow test_method_scenario_expectedBehavior or testMethod_scenario_expectedBehavior.[MOB-TEST-02] State Invariant Rule: Assert state transitions and invariants; ban trivial state mirror tests.[MOB-TEST-03] Entity Invariant & Codable Rule: Test calculations, validations, domain invariants, and non-trivial Codable serialization/parsing or error mapping; ban testing trivial getters or echo tests.[MOB-TEST-04] Contract Testing Rule: Repositories and data sources must be tested for contract compliance and error mapping; ban 1:1 pass-through mock echoing.[MOB-TEST-05] Bug-First Regression Lock: Every PR fixing a bug ticket or with title fix(...) must introduce a test reproducing the defect prior to the fix.[MOB-TEST-01], e.g., func test_userLogin_whenValid_isSuccessful()).setUpWithError() and tearDownWithError() for environment management.XCTAssertEqual, XCTAssertNil, XCTAssertTrue, etc.See implementation examples for XCTest setup/teardown, async tests, and UI test patterns.
async throws and use try await directly inside them.XCTestExpectation for callback-based async logic. Call expectation then fulfill() when done; then wait(for: [exp], timeout: 2.0) to block.init(service: ServiceProtocol)). Focus on logic isolation using mocks/stubs.XCUIApplication and accessibility identifiers.[MOB-TEST-01..05] Violations: Ban vague names, trivial state mirrors, echo tests, 1:1 mock echoing, and unverified bug fixes.XCTUnwrap() for better failure messages.When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant: