Trying to write tests for basic database operation, I'd like to understand what is the standard or proper pattern for setting up the data, so that only the functionality that should be tested is tested.
For example:
Trying to test INSERT
. To test INSERT
, the data should not be in the database, then the insert operation should be performed, and finally it should be retrieved to make sure that it did get there. However, it seems like this test depends on other functions to work well (i.e. SELECT
), which could be problematic.
How far should the assumption that auxiliary functions work go? Should this be somehow delegated to a set-up function? What is the standard procedure for testing functionality like this?
Thanks very much!