flutter_test_suite
Execute comprehensive Flutter testing including unit, widget, and integration tests with coverage reporting to validate mobile application functionality and reliability.
Instructions
Run complete test suite: unit tests, widget tests, integration tests with coverage report
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | Working directory (Flutter project root) | |
| coverage | No | Generate coverage report | |
| integrationTests | No | Include integration tests |
Implementation Reference
- src/tools/super-tools.ts:255-308 (handler)Handler function that executes the full Flutter test suite: runs unit/widget tests via flutter_test tool, optional integration tests using direct flutter command, and generates coverage HTML report using genhtml.handler: async (args: any) => { const results = { unit: null as any, widget: null as any, integration: null as any, coverage: null as any }; try { // Run unit and widget tests const testTool = flutterTools.get('flutter_test'); results.unit = await testTool.handler({ cwd: args.cwd, coverage: args.coverage }); // Run integration tests if requested if (args.integrationTests) { const { stdout } = await processExecutor.execute( 'flutter', ['test', 'integration_test'], { cwd: args.cwd } ); results.integration = { success: true, data: stdout }; } // Generate coverage report if (args.coverage) { const { stdout } = await processExecutor.execute( 'genhtml', ['coverage/lcov.info', '-o', 'coverage/html'], { cwd: args.cwd } ); results.coverage = { success: true, data: { htmlReport: 'coverage/html/index.html', lcovFile: 'coverage/lcov.info' } }; } return { success: true, data: results }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), data: results }; } }
- src/tools/super-tools.ts:235-254 (schema)Zod-like input schema validating cwd (required string), coverage (boolean, default true), integrationTests (boolean, default false).inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Working directory (Flutter project root)' }, coverage: { type: 'boolean', description: 'Generate coverage report', default: true }, integrationTests: { type: 'boolean', description: 'Include integration tests', default: false } }, required: ['cwd'] },
- src/tools/super-tools.ts:231-309 (registration)Registration of the flutter_test_suite tool in the super-tools Map, including name, description, schema, and handler.// Flutter Test Suite - Complete testing workflow tools.set('flutter_test_suite', { name: 'flutter_test_suite', description: 'Run complete test suite: unit tests, widget tests, integration tests with coverage report', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Working directory (Flutter project root)' }, coverage: { type: 'boolean', description: 'Generate coverage report', default: true }, integrationTests: { type: 'boolean', description: 'Include integration tests', default: false } }, required: ['cwd'] }, handler: async (args: any) => { const results = { unit: null as any, widget: null as any, integration: null as any, coverage: null as any }; try { // Run unit and widget tests const testTool = flutterTools.get('flutter_test'); results.unit = await testTool.handler({ cwd: args.cwd, coverage: args.coverage }); // Run integration tests if requested if (args.integrationTests) { const { stdout } = await processExecutor.execute( 'flutter', ['test', 'integration_test'], { cwd: args.cwd } ); results.integration = { success: true, data: stdout }; } // Generate coverage report if (args.coverage) { const { stdout } = await processExecutor.execute( 'genhtml', ['coverage/lcov.info', '-o', 'coverage/html'], { cwd: args.cwd } ); results.coverage = { success: true, data: { htmlReport: 'coverage/html/index.html', lcovFile: 'coverage/lcov.info' } }; } return { success: true, data: results }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), data: results }; } } });