Skip to content
pubscout

test_reflective_loader

0.6.0, released 7 weeks ago by tools.dart.dev

Runs test suites and methods discovered via reflection.

$ flutter pub add test_reflective_loader
Source repository

What it does

Provides functions to define reflective test suites and classes. It automatically discovers test methods, handles setUp/tearDown, and integrates with package:test grouping.

AI-written summary of version 0.6.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to write tests without manually listing each test method
  • You need hierarchical test groups generated from class names
  • You prefer annotation‑based test discovery in Dart

Skip it when

  • You are targeting platforms where reflection is disabled (e.g., Flutter web)
  • You need fine‑grained control over test registration beyond class‑based grouping

Strengths

  • Reduces boilerplate by auto‑discovering test methods
  • Integrates with package:test's group hierarchy for better IDE support
  • Supports expected‑fail and skipped tests via annotations

Weaknesses

  • Relies on Dart reflection which may not be available in all environments
  • Adds an extra dependency on package:test
  • Limited to simple naming/annotation conventions

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

void main() {
  defineReflectiveSuite(() {
    defineReflectiveTests(MyTestClass);
  });
}

@reflectiveTest
class MyTestClass {
  void test_example() => expect(true, isTrue);
}

Works with

Packages commonly used together with test_reflective_loader: ones it builds on, ones built on it, and its own family.