ORM testing for RethinkDB
I'm close to completing an ORM for RethinkDB in Python and I'm stuck writing tests. Especially with those related to operations save()
, get()
and delete()
. What's the recommended way to check if my ORM is doing what it should do when saving or deleting or retrieving a document?
Right now, for each test in my package, I create a database, populate it with all the tables the test models need (it takes a long time, almost 5 seconds / test!), Run an operation on my model (ex:) save()
and then manually run query the database (using the RethinkDB Python driver) to see if everything in the database is up to date.
Now I feel that this is not entirely true; maybe there is another way to write these tests, or maybe I can develop tests without even doing that many database queries. Any idea on how I can improve this or a suggestion on how this should actually be done?
source to share
You can create all your databases / tables only once for all your tests.
You can also use the raw data directory: - Run RethinkDB - Create all your databases / tables - Commit it.
Before each test, copy the data directory, run RethinkDB on the copies, then when your test is done, delete the copied data directory.
source to share