auto_test 0.2.1 copy "auto_test: ^0.2.1" to clipboard
auto_test: ^0.2.1 copied to clipboard

Support for discovering tests and test suites using reflection.

auto_test #

all_packages codecov

Support for discovering tests and test suites using reflection.

This package follows the xUnit style where each class is a test suite, and each method with the name prefix test or has @autoTest is a single test.

Methods with names starting with test or have @autoTest are run using the test() function with the corresponding name. If the class defines methods setUp() or tearDown(), they are executed before / after each test correspondingly, even if the test fails.

Methods with names starting with soloTest or have @soloTest are run using the test(solo: true) function.

Methods with names starting with fail or have @failingTest are expected to fail.

Methods with names starting with soloFail are run using the test(solo: true) function. and expected to fail.

Method returning Future class instances are asynchronous, so tearDown() is executed after the returned Future completes.

Methods with names starting with skipTest or have @skippedTest are expected to skip. test(skip: true) function.

Parameterized tests #

auto_test is very easy to use. Just decorate your parameterized test method with the @autoSource annotation. That's all. Then auto_test will generate arbitrary arguments for the parameters of the test method automatically.

@autoTests
class ParameterizedTextExample {
  @autoTest
  @autoSource
  void parameterizedTest(int a, int b) {
    Calculator sut = Calculator();
    int actual = sut.add(a, b);
    expect(a + b, actual);
  }
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0
likes
120
pub points
3%
popularity

Publisher

unverified uploader

Support for discovering tests and test suites using reflection.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

reflectable, test, uuid

More

Packages that depend on auto_test