Hi there,
I am proud to announce that - with my chimp acceptance tests - I have now officially arrived in fixtures-hell!
Fixtures-Hell is when you have shit-loads-of hard-coded data lying in JSON-files (totally independend from your factories that created them) and you now have to manually manage their conistency (p.e. _id
-references).
Scenario
- My app has multiple collections/use-cases all hanging together via
_id
-fields - they even reference to Meteor.users._id fields… plus I am using mizzoa:partitioner, have several tenants that I also need to test (which does not make it easier) - I have lots of tests that need hard-code data to test against
- I have some tests that need mass-data (for example 2000 docs to test pagination thru a table via
aldeed:tabular
)
Right now my solution is an “put-it-all-into-json”-files approach, which is probably responsible for me being in “Fixtures Hell”. Basically I create random-data via factories and then put them into json-files. Within my tests I then load data from the json-files back into the database. this kind of smells (puhh)
The bad thing about this approach is that I have to manually manage all those _id references - possible leading to inconsistent/corrupt data Damn this sucks!
What is best-practise for this scenario? Do you have any tips you can share for a medium-sized project?
Thanks a lot for your tips guys!