Software is eating the world, but few apps are useful without a database behind them too. As such, we want to ensure our database code is well-designed and tested. Test-Driven Development (TDD) is a good approach to software design, and as Stored Procedures are as much code as classes and methods, we can apply the same principles to unit test our database. Using this approach rather than integration testing via the app will reduce the risk involved in making changes to your database, and give much faster feedback too.
We will look at how to write unit tests for your database, which object types you should (and shouldn’t!) test, and how to run your tests automatically on a Continuous Integration server. By the end of the talk, you will feel empowered to write unit tests for your own SQL code, or pair on them with a database developer. You’ll also enjoy a new feeling of confidence working on your databases again, able to detect regressions early!
Familiarity with SQL and one or more RDBMS is assumed; demos will be given in T-SQL on Microsoft SQL Server 2014.