As your test suite grows, you need ways to toggle certain kinds of tests on or off. Maybe
you want to enable snapshot tests, skip long-running integration tests, or switch
between real services and mocks. In every case, you’re really saying, “Run this test only if
X is true.”
So where does X come from?
I like to rely on Go’s standard tooling so that integration and snapshot tests can live
right beside ordinary unit tests. Because I usually run these heavier tests in
testcontainers, I don’t always want them running while I’m iterating on a feature or
chasing a bug. So I need to enable them in an optional manner.