How to store Unit Tests

Unit tests are files containing code, just like any SQL Server stored procedure. Therefore, unit tests can be stored as regular SQL files. For example, you can add and manage them using source control. Test classes are schemas where the user can create test case procedures and any other related objects. These are stored as SQL schema objects.

Unit tests and test classes can be added and managed using any Git GUI client:

  1. Generate scripts of unit test stored procedures and save them to SQL files.
  2. Create a remote repository in any version control system to store SQL files.
  3. Commit SQL files to the repository with the help of any version control GUI clients.

This way, any changes made to the local files can be committed and stored remotely.

Unit Tests in GitHub Desktop

How to store Unit Tests using dbForge Source Control

dbForge Source Control is a powerful SSMS add-in for managing SQL Server database changes in version control systems. Similarly to any other Git client, it allows you to keep a remote copy of your files up to date by committing any local changes to a repository.

1. Create a remote repository.

2. Link a database with the unit tests to the version control system (for an instance GIT).

Link database to Source Control

3. Select version control repository and database development model dedicated or shared).

Remote repository connect using Source Control

4. Make some changes in the unit test structure locally.

5. dbForge Source Control will compare your local copy to the remote one and detect the changes.

Local changes in dbForge Source Control

6. Type a commit comment and commit the changes to the remote repository.

Commit changes using Source Control