Test Suite in Flask with MongoEngine Test Suite in Flask with MongoEngine flask flask

Test Suite in Flask with MongoEngine


There are two approaches I know of:

1. Separate Test Database

This is something that Django does automatically for unittesting. It simply uses a separate database for testing that it clears before and after every test run. You could implement something like this manually.

2. Use Mocking to avoid actually using the database

This is the more preferred method for most situations. You use mocking to simulate various functions so that the tests don't actually create/edit/delete information in a real database. This is better for multiple reasons, most notably for performance/speed of your unit tests.