# Ha IOS Testing

> Ha IOS Testing is an Agent Skill for testing & quality published in the home-assistant/iOS repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Unit and snapshot testing conventions. Use when writing tests, mocking dependencies by overriding Current, running the Tests-Unit scheme, or adding snapshot tests for new SwiftUI views.

- Skill name: `ha-ios-testing`
- Category: [Testing & Quality](https://www.openparable.com/skill/testing-quality/1)
- Source: https://github.com/home-assistant/iOS/blob/HEAD/.agents/skills/ha-ios-testing/SKILL.md
- Repository: home-assistant/iOS (2,262 GitHub stars when collected)

## SKILL.md

# Testing

## Running Tests

```bash
bundle exec fastlane test
```

Or in Xcode: use the `Tests-Unit` scheme with ⌘U.

## Testing Conventions

- Tests live in `Tests/` mirroring the source structure
- Mock dependencies by overriding `Current.*` properties in test setup
- Use `Sources/SharedTesting/` for shared test utilities
- Tests are excluded from SwiftLint enforcement

## Snapshot Testing

New SwiftUI views should have snapshot tests using helpers from `SharedTesting`:

```swift
import SharedTesting

func testMyView() {
    assertLightDarkSnapshots(of: MyView()) // tests both light and dark mode
}
```

---

Source: https://www.openparable.com/skill/testing-quality/ha-ios-testing (OpenParable). Cite the canonical URL above.
