Testing Go

Why do we test

Create assertions around our software given inputs a + b , we get c 1 + 2 = = 3

and this is really easy while we write pure functions. but unfortunately this isn't haskell and we're not writing academic papers

so we get a lot of side effects. printing to screen is a side effect

as we introduce these external dependencies it becomes more difficult to test. calling an API becomes a non deterministic activity, and we can't write the same value to a database if it already exists. and so we start introducing weird behaviors.

Mocks in test (Expectations vs Reality)

So we use mocks, which only really work because we have a certain idealised point of view on how that external dependency should behave. It is di

Using in memory services where we can

genai?

← Incoming Links (1)

Index
wiki • Line 58
"- Testing Go (2025-0..."

→ Outgoing Links

No outgoing links