Tuesday, December 1, 2009

Are unit tests REALLY a unit tests?

Those should test single unit. I know, that sometimes it's convenient
to test model with (some close) associations.

But I find quite odd that situation:
Creating PackageTest, and including app.packages_appendix and
app.appendix fixtures - it's reasonable for now.
But why the heck I need to include app.entry fixture (Appendix belongs
to Entry), and app.user (Entry belongs to User) and app.group (User is
in Group), and so - to the end of relation chain.
If I don't do that - I'll have missing database info instead of test
results.

I know that those are related (by transitions), but I never used so
deep recursion. Even If I did, I do It by contain, so it would be
better to get error from Containable, that I'm trying to use unknown
model.

After adding model and relations to my project some of my test cases
seize to pass untill I tell them to use fixtures they don't need.

Or am I doing something wrong?

Greg
ps. Thanks for CakePHP - it's great!

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: