Data blog — coding practices RSS

Unit testing for databases

Database applications can - and should - benefit from unit tests, but it is surprising how rarely database code is covered by such tests. One of the problems I suppose is with the fact that it can be pretty tricky to write an isolated test that does not modify the state of the system, so it is fully re-runnable and yields the same results each time. Martin Fowler wrote a good article discussing the unit tests concept - well worth having a look! Even if you decide not to implement unit tests for your stored procedures or queries, you can still implement them to ensure that the coding standards are observed. You can use unit tests to check naming conventions...

Continue reading