Most everyone just uses the built-in unit testing framework. And if what you're doing is unit testing, it's generally plenty. It's when you're doing more complicated testing - testing beyond making sure that each individual function has the correct output for various inputs - that the built-in unit testing might not be enough - or at least it doesn't provide additional tools to support fancier tests. However, it does provide enough to build more complicated testing tools if you want them. Given that unittest
blocks are essentially just normal functions that get called when the tests are run and given how D has fantastic compile-time reflection, you can do a lot inside of a unittest
block. There just aren't many testing-specific tools provided by the language or standard library. The few that there are can be found in std.exception - e.g. assertThrown
and assertNotThrown
.
Now, there are folks who think that the built-in unit testing facilities are lacking or who just don't like how they work for one reason or another, so several homegrown unit testing frameworks have been created by folks in the community (many of which - as DejanLekic points out - can be found on the D wiki), but at this point, most everyone just uses the built-in unit testing facilities.
EDIT: As Михаил Страшун points out, std.typecons does have basic some facilities for mocking objects if you're looking for something along those lines. e.g.
http://dlang.org/phobos/std_typecons.html#.AutoImplement http://dlang.org/phobos/std_typecons.html#.BlackHole http://dlang.org/phobos/std_typecons.html#.WhiteHole
They're excellent examples of what D's compile-time reflection can do and can be used with D's built-in unit testing facilities without needing anything more complicated added to the language or requiring a separate framework.