This is the second part on the serie about SSDT and database development and also my second blog post in collaboration with SQLShack.
In December 2012, a great addition was made to SSDT: The ability to do database unit testing.
However, this feature is not available on the free edition of SSDT. For doing unit test with SSDT you will at least need a Visual Studio Professional edition or above.
As you and the team members make changes to the database schema you can verify that these changes are working as expected or if they have broken existing functionality.
Please bear over with me making so many screen dumps but I was so fortunate to get a license of SnagIt® from TechSmith so I am also trying the possibilities of the tool in this blog post.
Usually you will want to baseline your database and then run some unit tests on the changes that you have made. Personally, I have made a habit out of taking a snapshot of the database I am working with at different stages and at least once a week. This way I can always go back to the state it was before I made the subsequent changes without having to roll back changes with TFS.
Because unit testing of your database is just a “Unit Test Project”, you can create and run database unit test without a database project. However, the only way to auto-generate tests for specific database objects is to use the database project.
When creating a test project from a database project Visual Studio will automatically generate some of classes for you. Most of the plumbing will be done that way. The most important class in that regard is:
Checking for the latest version of SSDT
First you need to check if you have the latest version of SSDT. This is done with the Check for Updates menu under the SQL menu.
You can read the rest of the post here.