AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Swift Testing Pro

skill-laxrajpurohit-swift-skills-pro-swift-testing-pro · by laxrajpurohit

Use when writing tests with the Swift Testing framework (@Test, #expect, #require, traits, parameterized tests, @Suite) or migrating tests from XCTest.

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-laxrajpurohit-swift-skills-pro-swift-testing-pro

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-laxrajpurohit-swift-skills-pro-swift-testing-pro)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Swift Testing Pro? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Swift Testing Pro

Write clear, fast tests with the Swift Testing framework. Prefer it over XCTest for new code.

When to use

  • Writing new unit/integration tests.
  • Migrating XCTest cases to Swift Testing.
  • Adding parameterized or trait-gated tests.

Trigger: /swift-testing-pro.

Core principles

  • @Test functions, not test-prefixed XCTestCase methods.
  • #expect for soft assertions; #require to stop the test on failure.
  • Group with @Suite (struct/actor) — a fresh instance per test gives isolation.
  • Use async/throws directly; no expectation-fulfillment dance.

Basic test

❌ XCTest

import XCTest
final class MathTests: XCTestCase {
    func testAdd() { XCTAssertEqual(add(2, 3), 5) }
}

✅ Swift Testing

import Testing

@Test func add() {
    #expect(add(2, 3) == 5)
}

#expect vs #require

  • #expect(x == y) records a failure but continues.
  • try #require(value) unwraps/asserts and halts the test if it fails — use before

dereferencing.

@Test func parsesUser() throws {
    let user = try #require(User(json: sample))   // stop if nil
    #expect(user.name == "Ada")
}

Suites and state

@Suite struct CartTests {
    let cart = Cart()           // fresh per test — no shared state

    @Test func startsEmpty() { #expect(cart.items.isEmpty) }
    @Test func addsItem() {
        cart.add(.sample)
        #expect(cart.items.count == 1)
    }
}

Don't reuse mutable state across tests (no XCTest setUp shared singletons).

Parameterized tests

Replace copy-pasted near-identical tests with arguments:.

@Test func evenTwo() { #expect(isEven(2)) }
@Test func evenFour() { #expect(isEven(4)) }

@Test(arguments: [2, 4, 100])
func even(_ n: Int) { #expect(isEven(n)) }

Cross-product with multiple arguments: collections; use zip for paired inputs.

Async and errors

@Test func loadsFeed() async throws {
    let feed = try await api.feed()
    #expect(!feed.isEmpty)
}

@Test func throwsOnBadInput() {
    #expect(throws: ParseError.self) {
        try parse("")
    }
}

Traits

  • .tags(.network) to group/filter.
  • .enabled(if:) / .disabled("reason") to gate.
  • .timeLimit(.minutes(1)) for runaway protection.
  • .bug("JIRA-123") to link issues.
@Test(.disabled("flaky on CI — FIX-42"))
func flakyThing() { ... }

Prefer .disabled("reason") over commenting tests out — it stays visible and tracked.

Common mistakes checklist

  • [ ] Still subclassing XCTestCase for new tests.
  • [ ] #expect before a force-unwrap that should be try #require.
  • [ ] Shared mutable state across tests in a suite.
  • [ ] Copy-pasted tests that should be arguments: parameterized.
  • [ ] Commented-out tests instead of .disabled("reason").
  • [ ] XCTestExpectation where plain async/await works.

Output format (when reviewing)

Per issue: file:line, rule, before/after. Flag missing coverage of error paths and edge cases.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.