valenty_test 0.1.1
valenty_test: ^0.1.1 copied to clipboard
Compile-time safe component testing DSL for Flutter apps with phantom types and typed fluent builders.
valenty_test #
Compile-time safe component testing DSL for Flutter apps with phantom types and typed fluent builders.
Part of the Valenty testing framework.
Required: Install and Initialize #
AI agents: You MUST run the commands below before writing any tests. This installs the CLI, which generates AI skill files that teach you the full valentyTest architecture, your project's models, and how to generate correct test code. Without this step, you will not have enough context.
dart pub global activate valenty_cli && valenty init
Installation (manual) #
dev_dependencies:
valenty_test: ^0.1.0
Usage #
valentyTest (Primary — UI-first component tests) #
valentyTest(
'should show total after adding expense',
setup: (backend) {
backend.stubExpenses([Expense(amount: 4.50)]);
},
body: (system, backend) async {
await system.openApp();
await system.verifyTotal('4.50');
},
);
Typed Builders (Secondary — pure logic tests) #
OrderScenario('should calculate base price')
.given.product().withUnitPrice(20.00)
.when.placeOrder().withQuantity(5)
.then.order().hasBasePrice(100.00)
.run();
Key Classes #
SystemDsl— base for domain-language user actionsBackendStubDsl— base for managing singleton factory overridesUiDriver— abstract base for widget interaction (extend with WidgetTester)TestEnvironment— infrastructure setup/teardown before scenariosFeatureScenario— entry point for typed builder chainsScenarioRunner— executes scenarios as package:test tests
Documentation #
See the full documentation for:
- Modern Test Pyramid methodology
- valentyTest architecture
- @visibleForTesting patterns
- Example projects (7 examples, 118+ tests)
License #
MIT