We’ve run into an issue on a project with one fixture that’s failing
because it’s getting loaded before another fixture that it’s dependent
on. Only happens on one test. Many other tests that use both fixtures
work fine. After a little searching on the net, I find that we’re not
the first to run into issues with the order in which fixtures get
loaded. The best solution I’ve found mentioned is pretty much total
abandonment of fixtures and instead using helper methods that create
appropriate data. The advantages seem to be a) solving the load order
problem we’re having and b) tests run faster. Nowhere that I see this
talked about do I see people discuss any disadvantages, so… my
questions are?
Are there any disadvantages to using helper methods instead of fixtures?
What are they?
If helper methods really are more advantageous than fixtures, why isn’t
it standard procedure to create the helper methods from the beginning?
Every bit of documentation I’ve read in regards to getting started in
testing says to create fixtures, with no hint of other, potentially more
appropriate, means of getting test data into the database.
Are there any other solutions to our problem that I haven’t discovered?