docs/src/content/docs/development/testing.md
# Run all tests
flutter test
# Run specific test file
flutter test test/battery_test.dart
# Run with coverage
flutter test --coverage
Tests are located in the test/ directory. The current suite is mostly flat and grouped by parser, model, and utility behavior, for example cpu_test.dart, container_test.dart, and ssh_config_test.dart.
Test business logic and data models:
test('should calculate CPU percentage', () {
final cpu = CpuModel(usage: 75.0);
expect(cpu.usagePercentage, '75%');
});
Test UI components:
testWidgets('ServerCard displays server name', (tester) async {
await tester.pumpWidget(
ProviderScope(
child: MaterialApp(
home: ServerCard(server: testServer),
),
),
);
expect(find.text('Test Server'), findsOneWidget);
});
Test Riverpod providers:
test('serverStatusProvider returns status', () async {
final container = ProviderContainer();
final status = await container.read(serverStatusProvider(testServer).future);
expect(status, isA<StatusModel>());
});
Avoid tests that depend on real SSH servers. Keep parser, model, and command-builder tests deterministic; add targeted fakes or fixtures when a feature introduces a service boundary.
There is no integration_test/ suite in the current repository. Add integration tests only when a feature needs end-to-end device or app-flow coverage.