Documentation: How to do unit testing
Author: sportoCreated Feb 8, 2018Updated Jul 1, 2026
Labelsdocumentation
What are you trying to accomplish?
I'm building a web server using Diesel. I want to unit test my code that access the DB via diesel. But I'm finding it unclear how to do this.
What is the expected output?
A documentation guide that explain best practices for unit testing while using Diesel and how to.
For example if I choose to hit the DB, how to clean it before each test, or run tests in transactions. Maybe something about factories.
If I would like to mock db call, how to achieve this.
Source: diesel-rs/diesel