SQL database unit testing in SSMS

dbForge Unit Test for SQL Server allows creating and running SQL unit tests directly in SQL Server Management Studio.

To start working with Unit Test, you need to install the tSQLt framework on the database you want to run tests on. You can do it right in SSMS.

1. In Object Explorer, right-click the required database, point to Unit Test, and then click Install Test Framework.

Launch the installation of the tSQLt framework from the Object Explorer or Unit Test main menu

Alternatively, go to Unit Test in the main menu and select Install Test Framework.

2. The Install tSQLt Framework window opens. Choose a target database, for which the framework will be installed and click Install.

Choose the target database in the Install tSQLt Framework window

3. The window shows the installation progress. Click the Minimize Application button to minimize the window.

View the tSQLt Framework installation progress in the Install tSQLt Framework window

4. Upon successful installation, the window displays the message tSQLt Framework installed successfully and the version of the tSQLt framework installed.

Message informing about the tSQLt successful installation appears

5. Click Finish.

Now the tSQLt framework is installed on the database and you can proceed to create unit tests.

The Add new test window is similarly called either from Object Explorer or from the Unit Test main menu.

If there are already unit tests for a database, you can run them in two clicks from Object Explorer.