Live data from Hacker News

Ask HN: I'm less productive with TDD. Am I doing it wrong?

news.ycombinator.com

21–24 of 24 posts

Re: Ask HN: I'm less productive with TDD. Am I doing it wrong?

#21
The real magic of testing is when you're working on a project with like 1000 engineers and millions of lines of code and you can just change shit that you don't fully understand and rely on the tests to make sure that you aren't breaking anything.

For a personal project I don't think it's all that helpful.

Re: Ask HN: I'm less productive with TDD. Am I doing it wrong?

#22
post #6

Earlier quoted context omitted.

You nailed it. Mocking data while testing is such a pain. Takes the fun out of writng tests.

Not sure what you mean by mocking data. Do you mean creating test data? If I can crank out tests by just tweaking test data, that's actually a good thing. That means that my test spec is as compact as possible. Mocking the database system is what I was referring to. Any two database systems have enough difference in datatypes, precise transaction semantics, default behaviors, and language dialect that it just isn't w…

Yeah mocking systems, been there done that and never again. I sincerely believe everyone should just start with the high level integration/system tests and these alone will bring enormous value when it comes to testing for regression. Don’t forget to add great reporting too. See my profile for this.

Re: Ask HN: I'm less productive with TDD. Am I doing it wrong?

#23
post #9

Earlier quoted context omitted.

> which depends on fast setup and teardown In postgres at least, Wouldn't your framework create a db transaction that then is rolled back at the end of the test?

That only works if the code you are testing does everything in auto-commit mode. Which is often a terrible idea. If your code uses transactions, then no, the framework cannot rely on rollback to do setup and teardown.

I use django with transactions and tests work fine. I think a transaction within a transaction is treated as a checkpoint.

Re: Ask HN: I'm less productive with TDD. Am I doing it wrong?

#24
post #9

Earlier quoted context omitted.

> which depends on fast setup and teardown In postgres at least, Wouldn't your framework create a db transaction that then is rolled back at the end of the test?

That only works if the code you are testing does everything in auto-commit mode. Which is often a terrible idea. If your code uses transactions, then no, the framework cannot rely on rollback to do setup and teardown.

Tests with transactions works fine in rails/rspec.
Post reply on HN