Approach to Integration Testing in D

Steven Schveighoffer schveiguy at gmail.com
Fri Feb 4 16:06:47 UTC 2022


On 2/4/22 7:38 AM, Vijay Nayar wrote:
> Greetings everyone,
> 
> ## Question
> 
> What is your approach to integration testing in D? Do you use `unittest` 
> blocks? Do you write stand-alone programs that interact with a running 
> version of your program? Is there a library that makes certain kinds of 
> testing easier?
> 
> For example, if I have a D project based on vibe.d, and I have custom 
> converters to receive REST API request bodies in different formats based 
> on the "Content-Type" HTTP header and other converter for the response 
> based on the "Accepts" header, what is the best approach to test the 
> entire program end-to-end?

I recently moved mysql-native integration tests to a subproject. I don't 
think unittesting should do integration tests *in the library itself*. 
But doing them via a unittesting framework in an external program seems 
to work well.

Links:
- common integration test project: 
https://github.com/mysql-d/mysql-native/tree/master/integration-tests
- vibe tests: 
https://github.com/mysql-d/mysql-native/tree/master/integration-tests-vibe
- phobos tests: 
https://github.com/mysql-d/mysql-native/tree/master/integration-tests-phobos

-Steve


More information about the Digitalmars-d-learn mailing list