BY JAMEL REID

 

This is the first tutorial in a 3 part series dedicated to demonstrating how to use a tool called Slacker to unit test a SQL Server database instance.

In this video, Jamel will be setting up a database with two tables and a stored procedure. He will then perform a manual test to verify the output of the stored procedure. This is equivalent to the automated test that  will be carried out using Slacker in upcoming tutorials.

Unit tests are used to check if small chunks of code are functioning as they should. It allows developers and stakeholders to verify that the code being implemented meets specification. Databases have not always benefited from unit testing. However, in recent times, multiple tools have emerged that allow us to tackle this problem.

Slacker is a transactional RSpec-based framework for developing automated tests for SQL Server (2005-2017) programmable objects such as stored procedures, scalar/table functions, triggers, etc. The framework has the added benefit of being able to be integrated into the Visual Studio built-in Unit Test Runner.  This allows it to add value and advance confidence in the development of your database.