trial 0.8.0-beta.5
The extensible test runner for DLang
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences 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.
Motivation
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
The trial
executable creates a custom main that will be embedded with your code. The build is created
using 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 --test
or -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.
Features
This library intends to provide a rich set of features that helps you to customize your test runs:
Configurable
The trial command can be configured through the trial.json
file. This file will be created when you run trial
For the first time. All the root properties are optional. For more details about this file look at the
Settings structure.
By default trial
will use the unittest
configuration. If you need to use test dependencies or other special
setup for the test build, you can add a trial
configuration inside your package file:
...
"configurations": [ {
"name": "trial",
"dependencies": {
"trial:lifecycle": "~>0.7.11",
"fluent-asserts": "0.14.0-alpha.11"
}
}
]
...
Read more about dub configurations.
Hacking
Please have a look at trial.interfaces
Building
Clone the repository and run dub build :runner
to create the app.
Structure
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.
Fluent Asserts
Since DLang does not have a rich assert library, you can use Fluent Asserts, a library that improves your experience of writing tests.
- Registered by Szabo Bogdan
- 0.8.0-beta.5 released a year ago
- gedaiu/trial
- trial.szabobogdan.com/
- MIT
- Copyright © 2022, Szabo Bogdan
- Authors:
- Dependencies:
- none
- Versions:
-
0.8.0-beta.5 2023-Jul-15 0.8.0-beta.4 2023-Jun-01 0.8.0-beta.3 2022-Dec-03 0.8.0-beta.2 2022-Jul-26 0.8.0-beta.1 2022-Nov-18 - Download Stats:
-
-
1 downloads today
-
9 downloads this week
-
35 downloads this month
-
18185 downloads total
-
- Score:
- 1.2
- Short URL:
- trial.dub.pm