Ever wanted to filter tests so you only run the ones you need to?

This can be easily done using test tags.

Super useful when you have dozens/hundreds of tests and you want to target specific ones from the command line. 👇

Example Code

import 'package:flutter_test/flutter_test.dart';
 
void main() {
  testWidgets(
    'Golden image test',
    (tester) async {
      await tester.pumpWidget(const MyApp());
      await expectLater(
        find.byType(MyApp),
        matchesGoldenFile('golden_image.png'),
      );
    },
    tags: ['golden'],
  );
}

Configuration Options

Tags are quite flexible and you can use them to tag:

  • an entire test suite (with the @Tags annotation)
  • a test group or an individual test (with the tags argument, as shown above)

More info on the test package documentation: