Skip to content

[PM-33573] llm: Add testing-ios-code skill with examples and references#2447

Draft
SaintPatrck wants to merge 1 commit intomainfrom
llm/testing-ios-code
Draft

[PM-33573] llm: Add testing-ios-code skill with examples and references#2447
SaintPatrck wants to merge 1 commit intomainfrom
llm/testing-ios-code

Conversation

@SaintPatrck
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-33573

📔 Objective

Adds a Claude skill for writing tests in Bitwarden iOS, with concrete examples derived from real codebase test files.

What changed:

  • skills/testing-ios-code/SKILL.md — Decision table for choosing test type (processor/coordinator/view/snapshot/service), setup pattern using BitwardenTestCase + ServiceContainer.withMocks, naming convention (test_functionName_behavior), co-location rule, and mock generation reference. Defers to Docs/Testing.md as authoritative.

  • examples/ — Four concrete examples based on actual codebase test files: processor tests (action/effect/error paths with @MainActor), coordinator tests (MockStackNavigator, route/view assertions), view tests (ViewInspector interactions + disabletest_ snapshot prefix), service tests (direct mock injection, assertAsyncThrows).

  • references/testing-gotchas.md — Non-obvious facts: disabletest_ prefix (not just disable), simulator device/OS requirements, BitwardenTestError, randomized test execution order, @MainActor requirement on async processor tests.

  • references/mock-generation.md — Sourcery AutoMockable workflow: annotation, manual trigger commands, generated file locations, ServiceContainer.withMocks pattern.

  • CLAUDE.md — Updates the Testing section from a verbose directive to a concise pointer to Docs/Testing.md + testing-ios-code skill. Also corrects the snapshot prefix from disable to disabletest_.

- SKILL.md: test type decision table, setup pattern with BitwardenTestCase and
  ServiceContainer.withMocks, naming convention, co-location rule, mock
  generation reference; references Docs/Testing.md as authoritative
- examples/processor-test-example.md: full processor test with setUp/tearDown,
  action test (state mutation), effect test (async), error path test
- examples/coordinator-test-example.md: MockStackNavigator, route assertions,
  action.type and action.view verification, child coordinator start check
- examples/view-test-example.md: MockProcessor, ViewInspector button/toggle
  tests, dispatchedActions vs effects, snapshot test with disabletest_ prefix
- examples/service-test-example.md: DefaultXxx with direct mock injection,
  success/error/side-effect tests, assertAsyncThrows pattern
- references/testing-gotchas.md: disabletest_ prefix, simulator requirements,
  BitwardenTestError, randomized execution order, @mainactor requirement
- references/mock-generation.md: AutoMockable annotation, Sourcery commands,
  generated file locations, ServiceContainer.withMocks pattern
- CLAUDE.md: update Testing section to pointer + correct disabletest_ prefix
@github-actions github-actions bot added the t:llm Change Type - LLM related change (e.g. CLAUDE.md files) label Mar 13, 2026
@github-actions
Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Detailse6c187df-ca18-4b18-996e-dfe9f8b0b600

Great job! No new security vulnerabilities introduced in this pull request

@SaintPatrck SaintPatrck added the ai-review Request a Claude code review label Mar 13, 2026
@claude
Copy link

claude bot commented Mar 13, 2026

Claude finished @SaintPatrck's task in 5m 16s —— View job


I'll analyze this and get back to you.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.72%. Comparing base (48115b8) to head (dd9afff).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2447      +/-   ##
==========================================
- Coverage   86.86%   85.72%   -1.15%     
==========================================
  Files        1841     2074     +233     
  Lines      162244   177135   +14891     
==========================================
+ Hits       140941   151843   +10902     
- Misses      21303    25292    +3989     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@claude
Copy link

claude bot commented Mar 13, 2026

test

@claude
Copy link

claude bot commented Mar 13, 2026

Overall Assessment: APPROVE

Reviewed the new testing-ios-code skill (SKILL.md, 4 examples, 2 references) and the CLAUDE.md update. The skill is well-structured with accurate examples that match real codebase patterns verified against actual test files (LandingProcessorTests.swift, AuthCoordinatorTests.swift, LandingView+ViewInspectorTests.swift). The CLAUDE.md fix correcting the snapshot prefix from disable to disabletest_ is accurate.

Code Review Details
  • ⚠️ IMPORTANT: BitwardenTestError file location is incorrect -- testing-gotchas.md line 33 says the type is in GlobalTestHelpers/ but it actually lives in TestHelpers/Support/BitwardenTestError.swift. An LLM following this skill would look in the wrong directory. Additionally, the protocol conformance shown (Error, Equatable) differs from the actual declaration (Equatable, LocalizedError).

    • .claude/skills/testing-ios-code/references/testing-gotchas.md:33
  • ⚠️ IMPORTANT: Confusing wrong-prefix example contradicts itself -- testing-gotchas.md lines 18-21 have a block labeled with a wrong-prefix marker that contains func disabletest_snapshot_empty() { ... } immediately followed by a comment saying "This is actually correct". This contradicts the block label and will confuse the LLM. Suggest removing the redundant correct example from the wrong-prefix block and keeping only func disable_snapshot_empty() { ... } as the wrong example.

    • .claude/skills/testing-ios-code/references/testing-gotchas.md:18-21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:llm Change Type - LLM related change (e.g. CLAUDE.md files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant