testing

testing is a skill for Claude Code, Codex from wangjianqi/AppStore. It costs 34 tokens per session (2,583 once invoked), scanned A, original, MIT.

An iOS testing guide covering unit tests, UI tests, XCTest, test doubles such as mocks and stubs, snapshot tests, asynchronous tests, coverage, and TDD. TDD means writing a failing test before implementing the code that should pass it.

In plain words
What is it for?
Use it when testing view models, services, repositories, storage, login flows, asynchronous code, and key app journeys.
Why use it?
It separates fast logic tests from slower user-interface tests and avoids relying on real databases or fragile screen details.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/wangjianqi/appstore/13-testing
Any agent
npx skills add wangjianqi/AppStore --skill 13-testing
Clone the repo
git clone --depth 1 https://github.com/wangjianqi/AppStore

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/wangjianqi/appstore/13-testing.svg)](https://agentmods.dev/skills/wangjianqi/appstore/13-testing)
Your own site
<a href="https://agentmods.dev/skills/wangjianqi/appstore/13-testing"><img src="https://agentmods.dev/badge/skills/wangjianqi/appstore/13-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,583 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00034 $0.02583
Opus 5 $0.00017 $0.01291
Sonnet 5 $0.00007 $0.00517
Haiku 4.5 $0.00003 $0.00258

Measured 3d ago against content hash cf506d48db57, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

ios-claude-skills/13-testing/SKILL.md · 372 lines

How it starts

The opening of the file, as written. The whole thing — 372 lines — stays where its author put it; the contents beside it link to each section on GitHub.

测试

测试分层

层级 类型 占比 速度 目标
ViewModel / Service 单元测试 70% 快(< 0.1s) 逻辑正确性
Repository / Storage 集成测试 20% 中(< 1s) 数据层协作
ViewController UI 测试 10% 慢(> 2s) 关键用户流程

原则:

  • ViewModel 和 Service 是测试重点,覆盖率目标 > 80%
  • VC 不写单元测试(太脆弱),用 UI 测试覆盖关键路径
  • Repository 层用内存数据库测试,不依赖真实 CoreData

项目配置

目录约定

AppTests/
├── ViewModels/                 # ViewModel 单元测试
│   └── CameraViewModelTests.swift
├── Services/                   # Service 单元测试
│   └── AuthServiceTests.swift
├── Repositories/               # Repository 集成测试
│   └── UserRepositoryTests.swift
├── UI/                         # UI 测试
│   └── LoginFlowTests.swift
├── Helpers/                    # 测试辅助
│   ├── MockNetworkService.swift
│   ├── StubData.swift
│   └── CoreDataTestStack.swift
└── Extensions/                 # 测试扩展
    └── XCTestCase+Async.swift

测试 Target 配置

  • Unit Test Target:AppTests,Host Application 设为主 App
  • UI Test Target:AppUITests,独立进程运行
  • @testable import App 允许访问 internal 成员

单元测试

ViewModel 测试模板

import XCTest
@testable import App

final class CameraViewModelTests: XCTestCase {
    private var sut: CameraViewModel!
    private var mockCameraService: MockCameraService!

    override func setUp() {
        super.setUp()
        mockCameraService = MockCameraService()
        sut = CameraViewModel(cameraService: mockCameraService)
    }

    override func tearDown() {
        sut = nil
        mockCameraService = nil
        super.tearDown()
    }

    func testStartCapture_whenAuthorized_callsServiceStart() async {
        mockCameraService.authorizationStatus = .authorized
        await sut.startCapture()
        XCTAssertTrue(mockCameraService.startCaptureCalled)
    }

    func testStartCapture_whenDenied_showsAlert() async {
        mockCameraService.authorizationStatus = .denied
        await sut.startCapture()
        XCTAssertTrue(sut.showPermissionAlert)
        XCTAssertFalse(mockCameraService.startCaptureCalled)
    }
}

Read the full file on GitHub · 372 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 372 lines · 34 tokens per session scan A cf506d48db57

Subscribe to this mod's changes

testing is a skill published in the GitHub repository wangjianqi/AppStore (10 stars, last pushed 3mo ago), licensed MIT. It adds 34 tokens to every session and 2,583 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

test-flutter

Flutter App のテスト実行・静的解析・フォーマット・テスト記述ガイド.

K9i-0/ccpocket · 26 tokens

test

Run tests. Use after code changes to validate. Arguments: unit (default, no GPU), e2e (with models), filter name, or all.

soniqo/speech-swift · 34 tokens

neo-cli-testing

Run and reason about the Neo CLI test layers under neo/ - unit, integration, e2e, and the generated-project / Neo-on-Neo smoke verification. Use before declaring any neo/ change done, or on "run the neo tests / cargo test / integration / e2e". Wraps the right command per layer inside nix develop, states network/Nix…

neohaskell/NeoHaskell · 105 tokens

dotnet-testing-advanced-tunit-advanced

TUnit 進階應用完整指南。當需要使用 TUnit 進行資料驅動測試、依賴注入或整合測試時使用。涵蓋 MethodDataSource、ClassDataSource、Matrix Tests、Properties 過濾。包含 Retry/Timeout 控制、WebApplicationFactory 整合、Testcontainers 多服務編排。 Make sure to use this skill whenever the user mentions TUnit advanced, MethodDataSource, ClassDataSource, Matrix Tests, TUnit dependency…

kevintsengtw/dotnet-testing-agent-skills · 211 tokens

build-and-verify

Build, test, and end-to-end verify the Multiplex visionOS/iPadOS SSH-tmux terminal app. Use this whenever you need to compile the app, run its unit tests, regenerate the Xcode project after editing project.yml or adding/ removing source files, or confirm a change works in the real app on the visionOS or iPad…

multiplex-term/Multiplex · 176 tokens

test-audit

Static test-suite quality audit - coverage from lcov/Istanbul/Cobertura/go/tarpaulin reports, pyramid shape (unit/integration/e2e ratio), anti-patterns (.only leaks, skipped tests, no-assertion tests, hardcoded sleeps). Stack-aware across 11 supported stacks.

marcoguillermaz/Tierward · 64 tokens