dbForge Unit Test for SQL Server
Features Overview

dbForge Unit Test is a handy SSMS add-in that lets you write, execute, and automate unit tests for SQL Server databases. Since it is based on the open-source tSQLt framework, it allows writing tests in regular T-SQL. The functionality of Unit Test aims to help you develop stable and reliable code that can be properly regression-tested at the unit level. Here is an overview of its main features.

Customizable unit tests for SQL Server databases

Create, customize, and manage unit tests and classes directly in SSMS using the clean and intuitive interface of Test List Manager.

To open it, go to Object Explorer, right-click the required database or a specific database object, point to Unit Test, and then click View Test List. Alternatively, you can proceed to Unit Test in the main menu and select View Test List.

Customizable unit tests
Direct test execution with the convenient single-tab Test List Manager

In Test List Manager, you can select the tests you want to run. Then you can proceed to one of the following:

  • Run a single test
  • Run all tests from a selected class
  • Run all tests against a selected database
  • Run all tests against multiple databases
Direct test execution from the single-tab Test List Manager
Access from the SSMS Object Explorer

As we mentioned previously, you can invoke Unit Test from the shortcut menu in Object Explorer—just a couple of clicks, and you are free to create, manage, and execute your tests.

Like with other dbForge products, the workflow is so simple that you don't need to learn to use it in order to get started. Just select the required tests, run the execution with a single click, and Unit Test will display the results in a matter of moments.

Operations in Object Explorer
Extensive tSQLt management

Install the tSQLt framework on any required database with a single click. This will provide your database with a number of stored procedures and functions, as well as an SQL CLR object.

And if you need to uninstall tSQLt, it will be removed along with the abovementioned stored procedures, functions, and the CLR object. As for the tests you created, you can either opt to keep or remove them along with the framework.

Learn more about installing the tSQLt framework
Extensive tSQLt management
Unit tests in T-SQL

dbForge Unit Test is based on the open-source tSQLt framework, which allows you to write and implement unit tests in T-SQL.

First off, go to Object Explorer, right-click the required database or a specific object, point to Unit Test, and then click Add New Test. Alternatively, you can access this functionality from the main menu.

After you specify the details about your new test and click Add Test, you will be able to manage the query template for this test.

Example: Unit testing of a stored procedure
Use of T-SQL
Predefined unit tests

Unit Test comes with a collection of predefined unit test examples, which are based on our best practices for test-driven database development. You can easily add them to any required database and become effective right away.

To get started with the predefined tests, go to Unit Test in the main menu and select Install Sample Database. Then select the server to install the sample database on, specify the name of your database, and launch the installation. Afterwards, you will be all set to work with predefined tests in Test List Manager.

Learn more about installing predefined tests
Predefined unit tests
Test class management

Test cases in tSQLt are grouped into test classes, so that you can gather similar unit tests in a single test class for convenience. Test classes can be created and organized in Test List Manager.

Test class management
CLI-powered test automation

Once you specify the required test classes and individual tests, you can use the command-line interface to schedule and automate the recurring execution of your unit tests.

Once you open the command prompt and navigate to the unittest.com file, located in the product installation folder, enter the required arguments—the actions you want to perform.

Learn more about CLI automation
CLI-powered test automation
Unit Test as part of your DevOps

Unit Test is available as part of a bundle called dbForge SQL Tools, which comprises 15 tools and SSMS add-ins that help simplify and automate nearly every aspect of SQL Server development and administration. All of these tools, including Unit Test, can become integral components of your DevOps cycle.

Learn how to integrate Unit Test into DevOps
Unit Test as part of your DevOps
Streamline all database tasks in SSMS with dbForge SQL Tools (including Unit Test) Try now