Hacker News new | ask | show | jobs
by LargeWu 634 days ago
> To avoid that you'll need to reset and configure its state for every single invocation.

Good testing frameworks just do this for you.

I generally prefer focusing testing efforts around what you describe - spinning up the entire system under test - because that's how the system is used in real life. There's definitely times you want to test code in isolation statelessly, but I find that engineers often err on the side of that too much, and end up writing a bunch of isolated tests that can't actually tell you if an http call to their API endpoint performs the correct behavior, which is really what we want to know.