The extensible test runner for DLang
To use this package, put the following dependency into your project's dependencies section:
Writing unit tests is easy with Dlang. Unfortunately when you have a big collection of unit tests, it get's hard to maintain and debug them. In order to avoid these problems, you can use this flexible test runner for D programing language.
There are many test runners for DLang and there are a few of them that have a lot of useful features that helps you to be more productive. Sometimes you need to use a custom feature that is not embedded with those libraries. Maybe it's about a custom test report, a new discovery mode or an integration with a third party app like an IDE or Jenkins. In each of these cases you need to dig in a project that is not maintained or you need features that does not match the creators view about this subject.
In order to be able to extend your test runs without depending on other people, I propose a simple idea, inspired from well known projects like TestNg, NUnit and mocha, that exposes a simple interface that allows you to add what you want, when you want.
How it works
trial executable creates a custom main that will be embedded with your code. The build is created
dub embeded as a library, so you don't need to install dub to use this runner. All the parameters that you
provide to trial will be passed directly to
dub. Right now trial provides only the
-t option that will
filter the discovered tests. For example
trial -t "The user should see a nice message when one test is run" will run
only the tests that contain that string in the name.
This library intends to provide a rich set of features that helps you to customize your test runs:
Please have a look at trial.interfaces
Clone the repository and run
dub build :runner to create the app.
There are two packages inside this project. The
runner packages contains the command line interface
to run your tests.
lifecycle provides the functionality like test discovery and reporters.
Since DLang does not have a rich assert library, you can use Fluent Asserts, a library that improves your experience of writing tests.
statistics are temporarily disabled.