Hacker News new | ask | show | jobs
by codr7 495 days ago
Coding is not religion for me, I have no patience for fundamentalism.

I will write as many tests as I need to feel confident, which depends on context.

And integration tests give me a lot more confidence than mocked unit tests.

1 comments

I hate coding fundamentalism with a passion too. The only thing I get really religious about in coding is the importance of trade offs.

The cost/benefit of writing a test before just consistently exceeded doing it after for me.

Same for integration, e2e or unit tests (there's never been a rule that says you can only TDD with a unit test).

The cost/benefit trade off for tests with mocks vs. database is a different topic - orthogonal to the practise of red/green/refactor, and one where IMO the trade offs are much less obvious.

I honestly can't see how writing integration tests before code would even look in practice, that puzzle usually isn't even close to finished at that point in time.

It sometimes makes sense for unit tests; I'll occasionally do that when I'm unsure about the API of the code I'm writing since it allows me to spend some time in the user's shoes.

But like I said, I don't do fundamentalism.