Install
$ agentstack add skill-mintuz-skills-swift-testing ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →About
Swift Testing Framework: Basics
Guidance for starting with Swift Testing (Testing framework) and writing clear, macro-driven tests.
Core Concepts
- Import
Testingto unlock macros; tests are plain functions annotated with@Test. - Name tests freely; use
@Test("Display Name")to set the navigator title. #expectis the primary assertion; pass a boolean expression to assert truthy outcomes.- Async/throwing tests are supported via
async/throwson the test function. - Works alongside XCTest in the same project.
Example: Simple Test
import Testing
func add(_ a: Int, _ b: Int) -> Int { a + b }
@Test("Verify addition function") func verifyAdd() {
let result = add(1, 2)
#expect(result == 3)
}
Expecting Throws
Use #expect(throws:) to verify a thrown error. Inspect the error via the closure overload when you need to assert the specific case.
@Test func verifyThrowingFunction() {
#expect(throws: MyError.self) {
try throwingFunction()
}
#expect {
try throwingFunction()
} throws: { error in
guard let myError = error as? MyError else { return false }
return myError == .invalidInput
}
}
Require vs Expect
#requirethrows immediately when the condition is false, halting the test early.- Handy for unwrapping optionals before continuing with more assertions.
@Test func verifyOptionalFunc() throws {
let result = try #require(optionalFunc()) // unwrap or fail fast
#expect(result > 0)
}
Recording Issues
Use Issue.record("message") to log and exit gracefully when continuing the test is pointless.
@Test func verifyOptionalFunc() throws {
guard let result = optionalFunc() else {
Issue.record("optional result is nil")
return
}
#expect(result > 0)
}
Best Practices Checklist
- [ ] Prefer
@Test-annotated free functions; no need for XCTest naming conventions. - [ ] Use
@Test("Name")to keep navigator titles readable. - [ ] Default to
#expectfor assertions; add multiple expects per test when logical. - [ ] Use
#requireto guard preconditions/unwrap optionals before further checks. - [ ] Assert thrown errors with
#expect(throws:), including specific case checks. - [ ] Mix Swift Testing with XCTest during migration; convert incrementally.
- [ ] Keep tests small and focused; one behavior per test function.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: mintuz
- Source: mintuz/skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.