test_beautifier 1.0.0+1 copy "test_beautifier: ^1.0.0+1" to clipboard
test_beautifier: ^1.0.0+1 copied to clipboard

A package designed to enhance the readability of your test cases.

example/lib/main.dart

import 'package:flutter_test/flutter_test.dart';
import 'package:test_beautifier/test_beautifier.dart';

/// A counter that can be incremented and decremented.
class Counter {
  /// Creates a new counter with the given [startValue].
  Counter(int startValue) {
    _value = startValue;
  }

  int _value = 0;

  /// The current value of the counter.
  int get value => _value;

  /// Increases the value by 1.
  void increment() => _value++;

  /// Decreases the value by 1.
  void decrement() => _value--;
}

void main() {
  group('Counter Tests', () {
    test(
      requirement(
        When: 'Counter is incremented',
        Then: 'value increases by 1',
      ),
      procedure(() {
        final counter = Counter(0)..increment();
        expect(counter.value, 1);
      }),
    );

    test(
      requirement(
        When: 'Counter is decremented',
        Then: 'value decreases by 1',
      ),
      procedure(() {
        final counter = Counter(0)..decrement();
        expect(counter.value, -1);
      }),
    );
  });
}
2
likes
0
points
177
downloads

Publisher

verified publisherjakesmd.dev

Weekly Downloads

A package designed to enhance the readability of your test cases.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter_test

More

Packages that depend on test_beautifier