Introduction
At some point in the recent past; I needed to port the integration tests of a Go service using PostgreSQL to MongoDB. I was surprised by the lack of resources for loading test fixtures, so I decided to document my approach here.
For PostgreSQL, we use go-testfixtures
to describe our test data as .yml files, which (naturally) does not support MongoDB.
I wanted a similar approach for MongoDB.
Test fixtures
In Ruby on Rails, applications with database access are tested using test fixtures described in YAML files. Before the test, each table is populated with the data described in the corresponding YAML file:
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.