How to store Unit Tests
Last modified: March 21, 2023
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:
- Generate scripts of unit test stored procedures and save them to SQL files.
- Create a remote repository in any version control system to store SQL files.
- 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.
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).
3. Select version control repository and database development model dedicated or shared).
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.
6. Type a commit comment and commit the changes to the remote repository.