I’ve always used the standard unit/functional/integration tests and
found them satisfying. I recently started a new project with existing
tests written using ZenTest. I was surprised to learn about the
controller/view/helper tests it provides.
On one hand I understand the reasoning for breaking down functional
tests into more specific concerns. It makes sense to test that a
controller is controlling properly and that a view is rendering
However in practice I’m worried that a view test would be far too
fragile. What exactly can you test? That a form shows up or that a
specific h1 tag is present? Given how quickly agile code changes, is it
really worthwhile to test views to that degree? If a view renders with
an error, you would still see that fault in a well constructed
I also don’t like the fact that you need to assign variables before
rendering the view. Not only does it seem clunky and redundant, you’re
liable to miss a problem that stems from the controller. To really
capture the interaction between a controller and a view, you’d end up
needing to do some integration/functional test anyway.
Is anyone else using view tests? What do you think of them? I’m
interested to know if you’re doing TDD and if you’re working on design
at the same time.