agentsclimarketplace

Swift testing

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/swift-testing

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill swift-testing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Standards for XCTest, Async Tests, and Test Organization. Use when writing XCTest cases, async tests, or organizing test suites in Swift. (triggers: **/*Tests.swift, XCTestCase, XCTestExpectation, XCTAssert)

SKILL.md

1.7 KB, 330 tokens by cl100k_base, as published. Nobody here has run it

Swift Testing Standards

Priority: P0

Implementation Guidelines

XCTest Framework

  • Standard Naming: Test functions must be prefixed by 'test' (e.g., func testUserLoginSuccessful()).
  • Setup/Teardown: Use setUpWithError() and tearDownWithError() for environment management.
  • Assertions: Use specific assertions: XCTAssertEqual, XCTAssertNil, XCTAssertTrue, etc.

Async Testing

  • Async/Await: Mark test methods as async throws and use try await directly inside them.
  • Expectations: Use XCTestExpectation for callback-based async logic. Call expectation then fulfill() when done; then wait(for: [exp], timeout: 2.0) to block.
  • Timeout: Always set reasonable timeouts for expectations to avoid hanging CI.

Test Organization

  • Unit Tests: Use protocols for dependencies and Inject them via constructor (e.g., init(service: ServiceProtocol)). Focus on logic isolation using mocks/stubs.
  • UI Tests: Test user flows using XCUIApplication and accessibility identifiers.
  • Coverage: Aim for high coverage on critical business logic and state transitions.

Anti-Patterns

  • No Thread.sleep: Use expectations or await.
  • No force unwrap in tests: Use XCTUnwrap() for better failure messages.
  • No assertion-free tests: A test that only runs code is not a test.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.