Skip to main content
Glama

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
NameRequiredDescriptionDefault
cwdYesWorking directory (Flutter project root)
coverageNoGenerate coverage report
integrationTestsNoInclude integration tests

Implementation Reference

  • 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 }; } }
  • 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'] },
  • 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 }; } } });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cristianoaredes/mcp-mobile-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server