This experience is emphasized even more if you work in a language with a REPL, like Clojure. The only value of tests, at that point, are to protect against regressions. The testing process with a REPL happens faster and more organically than writing unit tests, but it's less structured and harder to formalize. It's like comparing a structured debate to a conversation. What someone needs to do (and I'll do eventually)…
"The only value of tests, at that point, are to protect against regressions." Which is still extremely important.
TDD: tastes better without the T?
41–50 of 60 posts
Re: TDD: tastes better without the T?
#42The 80/20 rule applies to testing, but most people test things like basic ActiveRecord finders, etc. Why? Because writing a test of something complex requires a lot of thinking which hurts a bit.
In most apps, there is a "money work flow", such as signing someone up, taking an order, etc. If that stops working it's a really big deal. To adequately test it you probably need integration tests, but most devs don't bother to write that test because it's a pain and it fails a lot during development.
I think TDD is a bit of a cop out that can lead to an insufficiently specified API. If all it takes to make the test pass is to handle a narrow case of inputs, then you should feel no additional confidence just because the test passes.
Ideally running a test suite can tell you that the code is safe to deploy... Some tests can also speed up writing other code by making it easy to think through a problem with sample data.
If you are writing filler tests, useless tests, etc. just stop and figure out what is actually important.
If your unit tests take longer than 60 seconds you are probably doing it wrong.
Re: TDD: tastes better without the T?
#43I can completely understand there being disagreement about how to test code, how much testing is enough, when to write test (test driven vs write tests later), etc. But what boggles my mind is we've got people in this very thread who, if I'm interpreting their comments correctly, are arguing against doing any testing at all! WTF? How, in any non-trivial codebase, are you going to prevent regression? Does anyone here…
I hope people aren't arguing against integration testing. I agree with the original post that unit-testing can become onanistic fairly easily, but I think that that is a failure mode for just about any coding style (coding for the sake of coding vs testing for the sake of testing).
Re: TDD: tastes better without the T?
#44While I agree with the article that test cases are often overdone, I think that skipping test case implementation only works for those that have done enough design and implementation and learned where it should be skipped (e.g., where the only reasonable test case would just duplicate the implementation).
An important thing about TDD is that one is forced early to design the interfaces between components in such a way as to make testing possible. The test cases are less important than that the code is testable.
Re: TDD: tastes better without the T?
#45It takes a pragmatic developer to evaluate methodologies and patterns, utilizing the concepts that suites the job. Ultimately, mindless use of patterns and methodologies will not solve the problem.
Re: TDD: tastes better without the T?
#46These practices were called "hacking".
The Way of the Hacker is subtle indeed, yet obvious; and it is hence prone to being rediscovered from time to time by people outside the core discipline.
Re: TDD: tastes better without the T?
#47Test what you believe is fragile, or know is fragile.
Improve that later if you can, but your test suite is your safety net for keeping the nonobvious bits running. It's not a religion.
Don't test every assignment, just as you don't comment every assignment.
Re: TDD: tastes better without the T?
#48I'm pretty sure I lost a $150k job opportunity for saying that TDD is a waste of time if your product hasn't been validated as a money maker. I don't regret saying it either. Fast forward a month and I begin working on a pre-profit project that is so bloated with tests and unnecessary complexity that it took me a few days to really figure out what the hell was going on with the code. When I first started reviewing th…
Almost nobody in the Rails community uses foreign key constraints with ActiveRecord. I chafed against it at first, but if you're drinking their validation koolaid, it wouldn't add value in most cases, since the validations can add stronger constraints with better exceptions.
Re: TDD: tastes better without the T?
#49Re: TDD: tastes better without the T?
#50Earlier quoted context omitted.
I'm confused. This would be a REPL enhancement , meaning it would be something you use as needed. Currenly, using the clojure REPL to test things comes with a twinge of guilt, as it is not being captured for regression tests. (and I am too lazy to write unit tests separately) This would make it so that using the REPL would cycle between two "styles", ad-hoc experimentation and then, when you've found some repeatable…
Yes, yes I am. :) The reason being, that first, it's annoying to have to set up the boilerplate for the file. Second, it's annoying to have to convert what I just exercised in the REPL into a test. (Setup, tear down, asserts.) The reason TDD works and is fun is that you are using tests to learn and explore. It just so happens the artifact of that learning ends up living forever as a test. In a REPL, I'm doing that sa…