Hacker News new | ask | show | jobs
by hardwaresofton 2418 days ago
This is one of the best usecases for docker -- testing your system by spinning it up as it would be in production, with throwaway versions of the dependencies (the more realistic you can get them the better) is a fantastic way to test the overall system.

I'm surprised anyone is still not doing this. The most useful tests are the ones that test a customer's flows -- who cares if some function in your backend code does weird things when it takes a malformed string, the business's first concern is usually whether a customer can completely some flow.

1 comments

> who cares if some function in your backend code does weird things when it takes a malformed string

I would argue you need both. Without that unit test you might find it difficult to account for or track down that particular edge case. Plus a test like that takes about 5 minutes to write.

Agreed you definitely need both, but one is much more important to your company's continued existence.

To be fair, current best practice is to not write those tests at all, but to generate them and embrace the property based testing paradigm (ala quickcheck[0]). Put simply -- let the computer make random inputs and make sure your program maintains the proper invariants.

[0]: https://hackage.haskell.org/package/QuickCheck