[PM-33573] llm: Add testing-ios-code skill with examples and references#2447
[PM-33573] llm: Add testing-ios-code skill with examples and references#2447SaintPatrck merged 2 commits intomainfrom
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
|
Claude finished @SaintPatrck's task in 5m 16s —— View job I'll analyze this and get back to you. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2447 +/- ##
==========================================
- Coverage 87.09% 85.96% -1.14%
==========================================
Files 1859 2089 +230
Lines 164348 179153 +14805
==========================================
+ Hits 143134 154002 +10868
- Misses 21214 25151 +3937 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
test |
|
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
|
KatherineInCode
left a comment
There was a problem hiding this comment.
🤔 We may want to re-do these example files to be Swift Testing, rather than XCTest. That's something that's still very much in slow transition, though
|
|
||
| ## Annotation | ||
|
|
||
| Add `// sourcery: AutoMockable` above any protocol that needs a mock: |
There was a problem hiding this comment.
🎨 This goes inline:
protocol FeatureService: AnyObject { // sourcery: AutoMockable
| # For BitwardenKit | ||
| mint run sourcery --config BitwardenKit/Sourcery/sourcery.yml | ||
| ``` | ||
|
|
There was a problem hiding this comment.
🎨 AuthenticatorBridgeKit should also be in these lists
|
|
||
| ## Snapshot Tests Are Globally Disabled | ||
|
|
||
| Snapshot test function names must be prefixed with `disabletest_` (not `test_`). |
There was a problem hiding this comment.
🤔 As we move into Swift Testing, I believe we actually want to accomplish this through traits.
| description: Write tests, add test coverage, unit test, or add missing tests for Bitwarden iOS. Use when asked to "write tests", "add test coverage", "test this", "unit test", "add tests for", "missing tests", or when creating test files for new implementations. | ||
| --- | ||
|
|
||
| # Testing iOS Code |
There was a problem hiding this comment.
🎨 We are currently in the process of migrating from XCTest to Swift Testing. We probably want to update the skill to differentiate between the two—new test files should be Swift Testing if possible, but old files should remain XCTest for now (though at some point we may want to more formally write a skill for conversion). However, if there are things that Swift Testing can't do yet, we should default back to XCTest.
I'm not sure if that information would be here in the skill, or should actually be in the Testing.md file? 🤔
- 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
…add AuthenticatorBridgeKit
dd9afff to
07dcf4f
Compare
Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new Code Review DetailsNo findings. The skill content accurately reflects codebase conventions and patterns. |
|
@KatherineInCode great feedback. I've moved the informational details to |

🎟️ 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. Covers both XCTest (legacy, still widely used) and Swift Testing (preferred for new tests).
What changed:
skills/testing-ios-code/SKILL.md— Framework selection guide (Swift Testing for new files, XCTest for existing/ViewInspector/snapshots), decision table for choosing test type, setup patterns for both frameworks (struct+init()vsBitwardenTestCase+setUp/tearDown), naming conventions, assertion mapping table, co-location rule, and mock generation reference. Defers toDocs/Testing.mdas authoritative.examples/— Seven concrete examples based on actual codebase test files:struct/init(),@Test,#expect,#requirereferences/testing-gotchas.md— Non-obvious facts:disabletest_prefix (XCTest-only, with Swift Testing traits note), simulator device/OS requirements,BitwardenTestError(correct path:TestHelpers/Support/, correct conformance:Equatable, LocalizedError), randomized test execution order,@MainActorrequirement on async processor tests.references/mock-generation.md— SourceryAutoMockableworkflow: inline annotation format (trailing comment on protocol line), manual trigger commands for all four frameworks (includingAuthenticatorBridgeKit), generated file locations,ServiceContainer.withMockspattern.Docs/Testing.md— Adds Swift Testing examples alongside XCTest in processor and coordinator sections, framework selection guidance, Swift Testing quick reference patterns, and split test checklist (general/XCTest/Swift Testing).CLAUDE.md — Updates the Testing section from a verbose directive to a concise pointer to
Docs/Testing.md+testing-ios-codeskill. Also corrects the snapshot prefix fromdisabletodisabletest_.