Bench

Metadata and test runner for dart's unittest package.

Build Status

Libraries as Test Groups

@Group()
library bench.example;

Libraries represent test groups. By default, the name of the test group will be the name of the declared library (bench.example above); You may annotate the library declaration with @Group([description]) to override this default.

Annotate Test Functions

import 'package:bench/meta.dart';
import 'package:unittest/unittest.dart';

@Test('An example test case that passes.')
void testPass() {
  expect(true, isTrue);
}

Top-level functions that are annotated with @Test([description]) indicate test functions. All such functions will be auto-detected and run by the test runner.

Annotate Setup and Teardown Functions

import 'package:bench/meta.dart';

@Setup
void setup() => print('Setup is invoked one time before each test.');

@Teardown
void teardown() => print('Teardown is invoked one time after each test');

Each library (test group) may optionally contain one function annotated with @Setup and one function with @Teardown. These functions will be invoked for each test function in the library.

Run Bench

import 'package:bench/bench.dart' as bench;

void main() => bench.main();

Bench uses the MIT license as described in the LICENSE file, and follows semantic versioning.

Libraries

bench
bench.meta