3 ms·
The cool thing about tests is that they let you write code bottom up instead of top down. So instead of having to first build a UI so you can see if your algori
by cauterized 10y ago
The cool thing about tests is that they let you write code bottom up instead of top down. So instead of having to first build a UI so you can see if your algorithm does what you need it to, instead you can just implement the algorithm and write a little code to exercise it and make sure the results are what you expect. Then you can C&P that little bit of code and adjust it a bit to make sure edge case behavior is sane.
Things that helped me make the adjustment:
- a good test harness that made writing and running tests relatively effortless
- working for a few months on a team that used a methodology that wasn't strictly TDD but had a rule that pull requests would not be accepted without test coverage. (If your own team doesn't have this requirement, you may be able to find an open source project to contribute to that does.)
- Working for a different few months on a codebase that was already well tested and thus a) already had the tooling necessary to make writing tests easy, and b) contained plenty of examples of sensible tests.