mardi 2 juin 2015

setting up fake data in mongodb for testing

We have a project which we need to create a fake database and fake data for functional testing. Initially we started with a script that creates the entities using mongoose, initializes them and save them.

var StudentA = new Student();
StudentA.name = "Bob";
StudentA.surname = "Marley";
StudentA.save();

As the application grows and the relations between the documents increased this script has became and absolute mass and now it almost became the bottleneck in terms of the time we invest in application development.

The question is, is there a better way to do it like a library which fills the database with data in a more structured way? Or should we parse a file like a csv file and then push it to the mongo?

The question is for mongodb but it can be generalized into any kind of NO-SQL database that needs to be filled with fake data. (It is simpler with a SQL like grammar for RDBMS)

Aucun commentaire:

Enregistrer un commentaire