DEV Community

Discussion on: How much time do you spend writing tests?

ralphbrooks profile image
Ralph Brooks

So there are two main parts to the question. How do you test deterministic code - this is the code where I’d you give a certain input then you get a certain output. The other part is how do you do probabilistic tests for ML predictions.

For deterministic unit testing, I write the test first. If I write the test right, then it usually helps to guide the overall code. In right deadlines though , you need to focus on broad inputs and broad outputs. If you don’t have time to test one function , can you test a group of functions. The general rule I use is that if the user sees it then I would like to test it. Still figuring out best practices for probabilistic testing.