If you write a test that calls an API, gets or sets data in an actual database, sends a message to an outside system of any kind: that is *not* a unit test. You may have started out to write a unit test, but your journey took you much further than you meant it to and now you are in a dark and scary forest called "The Forest of Unintended Consequences" which has a river that runs through it named "The River of Randomly Failing Tests". Good luck, adventurer.

Follow

I have nothing against integration or end-to-end testing. My problem is the expectation that I can run a test and there wont be side effects or gotchas. I can re-run the test and get the same thing, every single time, and that there is no random chance involved, time of day issues or a possibility that I'll email grandma her receipt again. Integration and e2e tests could be written to avoid those issues too, but not when they're not treated as such.

Sign in to participate in the conversation
Ronin.World

Mastodon is a federated social network composed of instances. This particular instance is a portal into that social network, and a support group for workers of all types.