Integration tests
aliak
something at something.com
Mon Apr 20 20:19:49 UTC 2020
On Friday, 17 April 2020 at 16:56:57 UTC, Russel Winder wrote:
> Hi,
>
> Thinking of trying to do the next project in D rather than
> Rust, but…
>
> Rust has built in unit testing on a module basis. D has this so
> no problem.
>
> Rust allows for integration tests in the tests directory of a
> project. These are automatically build and run along with all
> unit tests as part of "cargo test".
>
> Does D have any integrated support for integration tests in the
> way
> Rust does?
D does not recognise any special testing directories afaik. But
you'll get the same affect as in rust if you have your
integration tests in a file that is not the modules you are
testing and run it after building the main library - or during
even.
With Dub it's quite easy to set up, you can see the optional
package as an example [0]. There's a tests directory that does
not have access to the optional package's internals. There's also
a unittest-compat configuration in dub.json that tests the
package alongside vibed (another d package)
For auto mocking, the only thing I've see that provides some
functionality is the unit-threaded package. But I've never tried
it.
[0]: https://github.com/aliak00/optional
More information about the Digitalmars-d-learn
mailing list