I've been trying to implement unit testing and currently have some code that does the following:
- query external database, loading into a feed table
- query a view, which is a delta of my feed and data tables, updating data table to match feed table
my unit testing strategy is this:
I have a testing database that I am free to manipulate.
- in setUP(), load some data into my testing db
- run my code, using my testing db as the source
- inspect the data table, checking for counts and the existence/non existence of certain records
- clear testing db, loading in a different set of data
- run code again
- inspect data table again
Obviously I have the data sets that I load into the source db set up such that I know certain records should be added,deleted,updated, etc.
It seems like this is a bit cumbersome and there should be an easier way? any suggestions?