nylo-core/claude-code/nylo-testing
Claude Code and agent skill by nylo-core/claude-code
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when writing, running, or debugging tests in a Nylo v7 Flutter project. Covers widget tests, unit tests, API mocking, factories, authentication simulation, time travel, state testing, and Nylo-specific assertions.
Install
npx vskill@latest install nylo-core/claude-code/nylo-testingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as nylo-core/claude-code/nylo-testing.
Nylo Testing
Overview
Nylo v7 provides a Laravel-inspired testing framework built on top of Flutter's test library. It includes helpers for widget testing, API mocking, authentication simulation, time manipulation, factories with fake data, and a rich set of custom assertions. Tests live in the test/ directory and use nyTest, nyWidgetTest, and nyGroup as entry points.
When to Use
- Writing unit tests for models, services, or utility functions
- Writing widget tests for NyPage or NyState-based pages
- Mocking API responses for network-dependent tests
- Simulating authenticated or guest users in tests
- Testing time-sensitive logic with time travel helpers
- Generating fake data with factories and NyFaker
- Asserting routes, state updates, toast messages, or lock/loading states
- When NOT to use: for standard Flutter widget tests that do not involve Nylo's state, routing, or API layers, use Flutter's built-in test utilities directly
Quick Reference
| Task | Code | |
|---|---|---|
| Initialize test file | NyTest.init() at top of test body | |
| Unit test | nyTest('name', () async { ... }) | |
| Widget test | nyWidgetTest('name', (tester) async { ... }) | |
| Group tests | nyGroup('name', () { ... }) | |
| Pump a NyPage | await tester.pumpNyWidget(child: MyPage()) | |
| Pump and wait for init | await tester.pumpNyWidgetAndWaitForInit(child: MyPage()) | |
| Mock API response | NyMockApi.respond('/users', {'id': 1}) | |
| Simulate auth user | NyTest.actingAs<User>(User(name: "Test")) | |
| Travel to a time | NyTest.travel(DateTime(2025, 6, 15)) | |
| Create factory model | NyFactory.make<User>() | |
| Fire state update | fireStateUpdate('HomePageState', data: {...}) | |
| Debug test state | NyTest.dump() |
Test File Structure
Lifecycle Hooks
nySetUpAll()- runs once before all tests in the filenySetUp()- runs before each individual test (state is auto-reset)nyTearDown()- runs after each individual testnyTearDownAll()- runs once after all tests in the file
NyTest.init() enables automatic state reset between tests.
Widget Testing
Pumping Widgets
Testing a NyPage Directly
testNyPage pumps the page, waits for initialization, then runs the expectation callback.
Simulating App Lifecycle
Checking Loading and Lock States
API Mocking
URL Pattern Matching
Type-Based API Service Mocking
Call Tracking and Verification
Authentication Testing
Time Travel
Factories and Fake Data
Defining Factories
Creating Instances
NyFaker Data Methods
NyFaker provides realistic test data generation:
| Category | Methods | |
|---|---|---|
| Identity | name(), firstName(), lastName(), email() | |
| Numbers | number(), randomInt(), randomDouble() | |
| Text | sentence(), paragraph(), word() | |
| Dates | date(), pastDate(), futureDate() | |
| Web | url(), ipAddress(), domainName() | |
| Location | address(), city(), country(), zipCode() | |
| Contact | phoneNumber(), companyName() |
State Testing
Firing State Updates and Actions
Asserting State Changes
Platform Channel Mocking
NyMockChannels automatically mocks common platform channels:
path_provider- returns temporary directory pathsflutter_secure_storage- in-memory key/value storeflutter_timezone- returns a test timezoneflutter_local_notifications- no-op notification channelsqflite- in-memory database
These are activated by NyTest.init() so tests run without platform errors.
Route Guard Mocking
Custom Assertions
Route Assertions
Backpack (Global State) Assertions
Environment Assertions
Toast Assertions
Lock/Loading Assertions
Debugging Tools
Test Modifiers
Custom Matchers
Common Mistakes
| Mistake | Fix | |
|---|---|---|
Forgetting NyTest.init() | Add it at the top of main() in every test file; it enables state reset and platform channel mocking | |
Using tester.pumpWidget instead of pumpNyWidget | pumpNyWidget wraps the widget in MaterialApp with Nylo theme support; use it for NyPage/NyState widgets | |
Async init() not completing before assertions | Use pumpNyWidgetAndWaitForInit or testNyPage to wait for async initialization | |
| API mock not matching requests | Check URL pattern: exact match vs wildcard (* = one segment, ** = multiple segments). Verify method matches too | |
| Auth state leaking between tests | NyTest.init() resets state between tests; ensure each test calls actingAs independently | |
| Platform channel errors in tests | NyTest.init() mocks common channels; if you use additional plugins, mock their channels manually | |
| Time not resetting between tests | Time is auto-reset by NyTest.init(); avoid setting time in setUpAll if individual tests need different times |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/nylo-testing/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nylo-core/claude-code/nylo-testing)