Tests for a REST store generator

Showing 1-1 of 1 messages
Tests for a REST store generator Tony Mobily 7/13/13 4:10 AM


I recently finished up https://github.com/mercmobily/JsonRestStores. I feel a little uneasy as I haven't yet written any unit testing.

The module is tricky at best to test: it allows you to create Json REST stores, AND interact with the store using the API directly.

So, the unit test should:

  • Start a web server that implements a number of stores. Ideally, I should have one store for each tested feature I suppose

  • Test the results while manipulating that store, both using HTTP calls and direct API calls

The problem is that each store can have override a lot of functions. To make things more complicated, the store has a range of database drivers it can use (well, potentially -- at the moment I only have the MongoDB driver). So, wanting to test the module with MongoDB, I would have to first create a collection, and then test things using each DB layer...

I mean, it would be a pretty epic task. Can anybody shed some light on how to make something like this simpler? It seems to have all of the ingredients to make the Unit Testing from hell (API calls, direct calls, database, different configurable DB drivers, highly configurable class which encourages method overriding...)