Unit Testing in Action

qznc qznc at web.de
Fri Oct 20 21:26:35 UTC 2017


On Friday, 20 October 2017 at 14:04:25 UTC, Mike Parker wrote:
> After a couple of weeks of quiet on the D blog, it's about to 
> get noisy again. The latest is is a post by Mario Kröplin of 
> Funkwerk describing how the company now uses D's built-in tests 
> in their codebase after several years of using third-party 
> frameworks.
>
> Blog:
> https://dlang.org/blog/2017/10/20/unit-testing-in-action/
>
> Reddit:
> https://www.reddit.com/r/programming/comments/77m8r8/ds_builtin_unit_testing_in_action/

Thanks for this post. Personally, I have not really hit the pain 
points described here, so I learned something. It is a valuable 
comparison of different unit-testing libraries and which aspects 
they tackle.

I took the following items from the post:

* Phobos should provide a UnitTestError class, so we can separate 
expectation libraries (which throw) from execution libraries 
(which catch). The community is not ready to decide on best 
library, so we need to try things and this separation would make 
that easier.

* fluent-asserts is considered the best expectations library. 
Syntax is `(x + y).should.equal(42).because("of test reasons");` 
and it gives nice output with code snippets.

* unit-threaded is considered the best execution library, because 
it shows description strings for each test. The parallelization 
feature did not work out for the author.

* coverage is not sufficiently solved. The author suggests to 
reformat code so short-circuit evaluations become multiple lines?

* Fixtures and test parameters do not require special support 
because builtin features like static foreach are sufficient.


More information about the Digitalmars-d-announce mailing list