fluttertest_ai 0.2.0
fluttertest_ai: ^0.2.0 copied to clipboard
A local-first CLI that analyzes Flutter apps and generates conservative, runnable tests without an API key.
example/README.md
FlutterTest AI Example #
This example demonstrates how to use FlutterTest AI to analyze a Flutter project and generate tests.
Getting Started #
- Install FlutterTest AI (if not already installed):
dart pub global activate fluttertest_ai
- Navigate to a Flutter project:
cd path/to/your/flutter_project
- Run the commands:
# Verify your environment
fluttertest-ai doctor
# Analyze the project
fluttertest-ai analyze
# Generate tests
fluttertest-ai generate
# Run the generated tests
fluttertest-ai run
# Fix any failing tests
fluttertest-ai fix
# Generate reports
fluttertest-ai report
What Gets Generated #
Generated test paths mirror the source path under lib/, moved under test/. Unit tests
are suffixed _test.dart; widget tests are suffixed _widget_test.dart. For example:
lib/counter.dart->test/counter_widget_test.dart(widget test)lib/core/validators.dart->test/core/validators_test.dart(unit test)
After running fluttertest-ai generate, you'll find new test files in the test/ directory:
test/
├── counter_widget_test.dart # Widget test for the widget(s) in lib/counter.dart
└── core/
└── validators_test.dart # Unit tests for lib/core/validators.dart
Each generated file includes:
- A header identifying it as generated by FlutterTest AI
- A confidence score for the generated tests
- An ownership marker for safe refresh and repair
Example Output #
Analyzing Flutter project...
State management: setState (85% confidence)
behavior: setState() called in 1 file(s)
class inheritance: _MyHomePageState extends State
Generating tests...
✓ test/counter_widget_test.dart
Running generated tests...
✓ 1 passed
Next Steps #
- Review the generated tests before using them in production
- Run
fluttertest-ai fixto automatically repair common failures - Run
fluttertest-ai reportto generate Markdown and JSON reports - Use
--dry-runto preview what would be generated without writing files - Use
--forceto refresh previously generated tests