Re: Testing without Fixtures (?)

jhearn
Mon, 09 Feb 2009 17:24:56 -0000

Because of an NDA, I can''t really talk about what is in the DB or why
it all needs to be there with any specificity, but will try to explain
by analogy.

Suppose I have an app that tries to smartly generate a list for
grocery shopping.  The db has a table for all the items sold by the
grocery store.  There is also a table for categories of groceries, and
a join table that associates the items with the categories.  Cheddar,
for instance, could be joined with the categories: cheeses, dairy,
items_that_require_refrigeration, etc.  We also a have table for
different scenarios we might be shopping for, e.g. general_grocery,
camping_trip, dinner_party, christmas_baking, etc. and some items are
joined with certain scenarios.

The way this might play out in our app:  We select dinner_party as our
scenario and indicate that we need to buy some cheese.  The app
provides a list of cheeses to pick from.  If we add camembert, perhaps
the list suggests a bottle of white wine that pairs well with the
cheese, but if we add parmesan, the list gives us the option of adding
spaghetti, pasta sauce, and/or all the raw ingredients to make our own
pasta sauce.

Suppose the scenario is camping_trip, and we add graham crackers.
Chocolate and marshmallows are added to the list automatically.
However, if we add graham crackers while shopping for general_grocery,
those items are not added.

Some of that behavior may sound a bit obnoxious for generating a
shopping list, but remember this is an analogy, and in the real app,
that sort of thing is more appropriate. The point is that the behavior
of the application is heavily dependent on the grouping relationships
of a large data set.  So really, our tests need to verify the data
relationships as much as the code.  I can''t really do that if I use a
different data set, or restrict the data to a smaller, more manageable
load.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org