Testing D database calls code for regression

aberba karabutaworld at gmail.com
Sun Mar 18 19:51:18 UTC 2018


On Friday, 16 March 2018 at 21:15:33 UTC, H. S. Teoh wrote:
> On Fri, Mar 16, 2018 at 08:17:49PM +0000, aberba via 
> Digitalmars-d-learn wrote:
>> [...]
>
> The usual way I do this is to decouple the code from the real 
> database backend by templatizing the database driver.  Then in 
> my unittest I can instantiate the template with a mock database 
> driver that only implements the bare minimum to run the test.
>
> [...]

Mocking a fake database can also be huge pain. Especially when 
something like transactions and prepared statements are involved.

Imagine testing your mock for introduced by future extension.


More information about the Digitalmars-d-learn mailing list