- Home
- Skills
- Rshankras
- Claude Code Apple Skills
- Integration Test Scaffold
integration-test-scaffold_skill
- Swift
56
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill rshankras/claude-code-apple-skills --skill integration-test-scaffold- SKILL.md13.0 KB
Overview
This skill generates a cross-module integration test scaffold for Swift projects. It builds mock servers, in-memory stores, and a test environment that wires networking, persistence, and business logic together so you can run realistic integration tests without real servers or databases.
How this skill works
The skill inspects module boundaries and suggests which layers to integrate (network, repository, view model, etc.). It generates a URLProtocol-based mock server, a mock server helper, in-memory SwiftData and UserDefaults substitutes, and a test dependency container that wires session, model container, defaults, API client, repository, and view models. Example integration tests covering happy paths, caching/offline behavior, writes, and request verification are produced.
When to use it
- You want end-to-end integration tests that avoid real servers and DBs
- You need to verify data flow across layers (API → Repository → ViewModel)
- You want to test networking plus caching or persistence together
- You need a repeatable test harness with captured requests and predictable responses
- You want request verification (headers, auth) and caching/offline scenarios
Best practices
- Map integration boundaries before generating scaffolding so only relevant layers are included
- Prefer URLProtocol when you need to intercept real URLSession traffic; prefer protocol-based swaps for finer unit-test isolation
- Reset mock server and in-memory stores between tests to avoid state leakage
- Keep test data in factories and reuse TestEnvironment.create() to keep tests concise
- Write both happy-path and failure-path integration tests to catch wiring and mapping issues
Example use cases
- Full-stack flow: API → Repository → ViewModel fetch, cache, and display verification
- Offline fallback: load from cache when API fails and ensure UI state reflects cached data
- Write-through: add item via ViewModel, assert API POST was sent and item saved in the in-memory store
- Request formation: assert headers, authorization, and HTTP methods using captured requests
- Error handling: simulate server 500 and verify ViewModel enters error state and no invalid writes occur
FAQ
It provides a MockURLProtocol registered on a URLSessionConfiguration that intercepts requests, returns configured responses, and records captured requests for verification.
Can I test Core Data or SwiftData with this scaffold?
Yes. The scaffold creates an in-memory ModelContainer for SwiftData (or you can adapt to an in-memory Core Data stack) so tests persist and query without disk IO.