| || |
accessing & versionning persistant data for unit tests purposes
When unit testing a web app, one may whish to access the test data (data layer) at any time in order to re-run the unit-test classes and to detect potential regressions. Furthermore, one may wish to:
- proceed without polluting the production code with test related stuff
- access the data in its original format (no reformatting such as RDB -> XML)
- separate the test code and the test data
- preserve the test data from delete / update operations in order to perform assertions
- not to lose in performance
We have identified a few scenarios respecting some of the above requirements:
1.- hardcoding the data in the test code
2.- save de data sets in a defined standard format (flat file, xml, ...) and rewrite the managers classes in order to access the data in that particular format
3.- keep the data in its original data source and flag it as test data
4.- download current data source content in flat files, load the data test, perform the tests, and reload the data source ff to reset its content
5.- add a connection parameter to switch to test data or normal data...
Does anyone has alternative experiences or feedback on one of the above ones?
Thanks a lot.