How to populate a test database in velocity/cucumber


I’ve started using the standard recommended xolvio:cucumber and velocity:html-reporter.

I want to test against a fairly big test database. I have a dump of the data created by mongodump, and I usually run a script that does mongorestore to load it into a reset local meteor database.

I can imagine having a hook in cucumber’s this.Before that tells the server to import the .json files by reading the text files, parsing them, etc. by hand. This feels ugly. Is there some clean canonical way to import this data into the mirror database?


You can define a Meteor method in a fixtures package that is debugOnly: true (Example: To load the data into the DB you can still use mongodump. Just use child_process.exec to execute it from the Meteor method.
The package can reset your database in case mongodump doesn’t handle this.


Thanks Sanjo.

For future readers, one key piece of info for your implementation is that the velocity mirrors all point at a local mongodb database meteor-cucumber

So in my case, I restore via

mongorestore -h -d meteor-cucumber ./testDB