The SandboxDB database project is a simple local database with just a few basic tables and a stored procedure, InsertCustomer which just takes 3 parameters and INSERTs a record in to dbo.Customer. In this example I used SQL Server 2016 and VS 2015, and I have a Solution called SandboxDB which contains a SandboxDB SQL Server DB project, and a SandboxDBTests C# class library project. I hope to expand on this with a series of posts on more CICD in the near future including using SqlTest to test SSIS packages and integrating SqlTest based unit tests with TFS.įirst we are going to need to set up a Database Project in Visual Studio and add a few NuGet packages to our solution. I only recently became familiar with unit testing for SQL Server myself, so hopefully this post can help beginners to get started. In this post I am going to walk through my own experience setting up some simple unit tests with NUnit and SqlTest. You can read his introductory post about SqlTest, and some of the deficiencies of existing tools, at his website – and check out the code on github. Thankfully, on the subject of tools, there has been a lot of progress over the last several years.Ī colleague of mine, Mark Wojciechowicz, recently took it upon himself to create a library that can be used in Visual Studio with the NUnit framework and the NUnit3TestAdaptor (both can be downloaded via Nuget) to conduct unit tests of SQL Server objects – aptly named SqlTest. Some of this is due to our ingrained design patterns as SQL developers, and some is due to a lack of tools. The nature of databases and transactions don’t always lend themselves to easily run a large number of small individual tests of things such as complicated queries or stored procedures. Unit testing SQL development is generally more difficult than other, more “traditional”, application development, such as with.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |