Test data in database (fixtures)

103 views
Skip to first unread message

Ivan Blazevic

unread,
Nov 2, 2015, 8:29:44 AM11/2/15
to LoopbackJS
Hi,

I have a question about creating test data for running tests. We want to test our endpoints, of course, and in the way that each test is independent. For our last project that was express/mongoose we used a module that allowed for creating fixtures in mongo and it worked great https://github.com/powmedia/pow-mongodb-fixtures . Btw we are using postgres for current loopback project.

All the loopback examples I've seen so far tend to create data with making request to endpoints before actual test part, and I'm pretty sure that doesn't scale well.

Is there a preferred way for doing this with datasource juggler, or is it just dependent on using some other external modules for creating test data in postgres, if so if someone can recommend from the experience so far what worked good for postgres.

Thanks in advance,
Ivan

Ivan Blazevic

unread,
Nov 3, 2015, 6:00:07 AM11/3/15
to LoopbackJS
I found an example of tests in this project https://github.com/strongloop/loopback-example-app . Few question I have for that:

1. It loads the app and puts all the sample data in when app is started. All tests are in only one file for this example, so one of my concerns if we do load it like this it will probably be to slow to get the app running for every single test file
2. if we find a way to load app once for all files and that sample data, tests are not really isolated cause they all share the same data (might not be too big issue if done right)

If someone already did the project, we would really appreciate the experience with testing the application
Reply all
Reply to author
Forward
0 new messages