Ram wrote:
<Yikes!>
ok that was some intense stuff. I dint understand a lot of stuff going
around because, as established before, I dont have experience writing
tests.
But the following are the things Im taking out of this discussion.
- jump in the dirt. Do TDD for your existing app by starting all over
again if you have to. Thats the only way to go (?) / thats the best
way to go to become a better programmer (?)
Starting over, as Phlip suggested, is pretty drastic, but it will make
sure that everything is tested.
- i dont absolutely need any external tools besides test::unit.
Right, although you should try RSpec as a replacement for Test::Unit and
see which you prefer.
I
probably would use the right tools if i ever felt the need for them in
the first place
Huh?
- use fixtures when I have to test something that uses complex
associations between models. especially when the alternative is to
spend a lot of time and brain on mocking/stubbing them instead. (I
have to mention I dont know the difference/similarities/functions of
mocking and stubbing completely)
Check out Martin F.'s article “Mocks aren’t Stubs”, as well as the
RSpec docs. There’s also a hell of a lot of info in the wiki at c2.com,
though some of it may not apply to what you’re doing…
- i dont have any client documentation to show for these tests. theyre
only for the sake of testing my code itself. So ill skip over RSpec
and Cucumber (until i feel a need for them)
Cucumber is definitely for client-documentation-type tests. RSpec,
however, is useful as a replacement for Test::Unit if (like me) you find
that it’s easier to use it for unit tests. (Phlip’s characterization of
RSpec is IMHO inaccurate.)
- test code keeps evolving. I need to optimize test code as much (or
more ?) as i optimize dev code.
Maybe. But differently. Optimize test code for readability and
accuracy – unlike production code, you’re not going to be running
thousands of tests every second.
and tests breaking out of nowhere will
be a way of life (?)
Perhaps. At least you’ll know right away when something needs work.
i am going to be adding features to the app in between too. anything I
have to keep in mind while doing that?
Try to get everything working before adding the next feature.
when do I start on integration and functional tests?
Good question. And many Rails developers are less gung-ho about these
than about unit tests. (I’m one such developer at the moment, so I don’t
really have a good answer for you yet.)
Also, any good articles that could help me gain some perspective on
the task i have ahead of me?
Other than the c2 wiki…hmmm. There’s an interesting forum thread on
SimpleTest (PHP) that was very helpful to me…I’ll see if I can dig up
the URL. Phlip, do I remember correctly that you’ve got some stuff
around the Web on the subject?
my 2 cents worth… i personally like the feel autotest gives.
especially for TDD. but hey… no experience. only tryouts and
screencasts.
Autotest is just about essential for TDD. On Mac OS, I find it helpful
to integrate it with Growl (there are a number of ways to do that – a
search should turn them up).
Please DO let me know if I have taken away the right things from here
to get started with writing tests for my existing app.
I think so.
I hope this discussion goes further and provides insights for many
more in my place.
Thanks Fernando, Marnen, Phlip, Brandon and Hans
You’re welcome! Good luck.
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]