Unit Test

To Mock or Not to Mock - Mocking Unit Tests

by Lee Napthine, 14 March 2025

If you’ve ever written unit tests, you’ve probably encountered situations where a function depends on an external API, a database, or a cloud service. These things are difficult to control in a test environment. This is where mocking comes in.