Skip to content
pubscout

elementary_test

2.1.1, released a year ago by elementaryteam.dev

Testing library for apps built with the Elementary architecture.

$ flutter pub add elementary_test
Source repository

What it does

Provides tools and the testWidgetModel function to easily test WidgetModels and manage their lifecycle phases when using the Elementary architecture package.

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

Use it when

  • You are building Flutter applications using the elementary architecture package
  • You need to test WidgetModels and manage their lifecycle events in tests

Skip it when

  • You are not using the elementary architecture package
  • You are looking for a general-purpose widget testing or BLoC testing library

Strengths

  • Simplifies testing of Elementary WidgetModels
  • Provides lifecycle manipulation tools like tester.init() and tester.didChangeDependencies()

Weaknesses

  • Strictly tied to the elementary ecosystem
  • Limited utility outside of the Elementary architecture

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
4
void main() {
  testWidgetModel<TestPageWidgetModel, TestPageWidget>(
    'calculatingState test',
    setUpWm,
    (wm, tester, context) async {
      tester.init();
      expect(wm.calculatingState.value, isFalse);
    },
  );
}

Alternatives

Packages that do the same job and could replace elementary_test.

  • bloc_test

    A testing library that makes it easy to test blocs and cubits.

  • flutter_svg_test

    A testing library for finding and verifying flutter_svg images in widget tests.

  • alchemist

    Streamlined golden testing tool for Flutter with local and CI-safe output support

  • patrol_log

    Log package for Patrol, a Flutter-native UI testing framework

Works with

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