On Sun, Aug 23, 2009 at 3:06 PM, Steve Midgley<[address removed]> wrote:
> Whatever framework you decide to use, one tip that might be helpful in
> building legacy tests, is to start with your "smoke tests." You could build
> a lot of: "Given this set of parameters, this GET request should return
> 200-Ok, and in the resulting HTML there should be an input tag with this
> value." This sets some a baseline harness around your system to define it's
> behavior in the most fundamental way (these parameters in, this html out).
>
> It's not the ideal way to build TDD from the ground up, but I've found it
> can help to give you some control over your overall environment, so that as
> you change code, you can be confident that your major functionality hasn't
> just failed.
Yes, this is a very good point. If you really must write tests for
your existing code, start with some high-level 'happy path' tests of
the flow of your external user interface. This can avoid the catch-22
of lower-level unit tests forcing you to refactor when you don't have
any tests to catch bugs.
-- Chad