bench 0.2.18
bench: ^0.2.18 copied to clipboard
A test bench.
Bench #
A test bench for Dart.
Libraries as Test Groups #
@TestGroup(description: 'Example')
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 @TestGroup(description: 'whatever') to override this
default.
Annotate Test Functions #
@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 #
@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.
Reflect and Run Tests #
import 'package:bench/bench.dart' as bench;
void main() => bench.reflectTests();
Run Headless Browser Tests on http://drone.io #
Notice #
A recent change to the way the Dart SDK is packaged has led to the
unavailability of the content_shell executable on drone.io (out of the box);
please vote up this issue to help get it back!
import 'package:bench/bench.dart' as bench;
main() {
useHtmlEnhancedConfiguration();
bench.reflectTests();
}
<body>
<script type="text/javascript" src="packages/browser/dart.js"></script>
<script type="text/javascript" src="packages/unittest/test_controller.js">
</script>
<script type="application/dart" src="path_to_browser_tests.dart"></script>
</body>
sudo start xvfb
dart --package-root=packages packages/bench/main.dart path_to_browser_tests.html
Bench uses the MIT license as described in the LICENSE file, and follows semantic versioning.
