Importing an Azure SQL Database Schema to a SQL Server Database Project in SSDT
The following SQL unit testing demonstration will be completed in the below three phases: SSDT allows us to develop SQL Server database projects and it also provides Analysis Service, Reporting Service and Integration Service projects.Īzure SQL: It is a cloud based relational database that can be use database as a service so that we can use Azure SQL database without any physical hardware or on premise-installation. SQL Server Data Tools: It is also known as SSDT, another required tool to develop SQL unit testing projects. Visual Studio 2017: It is an integrated development environment (IDE) which allows us to develop various project types in different programing languages. In this article we will use the following tools: Assume that we are developing a stored procedure and we know that it will not return any rows, so we can configure a test condition to verify this behavior of the stored procedure and then it can be tested according to this condition as part of a review of the database, or latest database changes. The advantage of SQL unit testing is to develop more robust database designs, because these objects have already been checked before production deployment, so SQL unit testing process allows us to minimize the errors which are related to database objects. The SQL unit testing approach allows us to test individual and programmable part of database objects such as stored procedures, functions, triggers and schema. Now let’s review the basic concept of unit testing concept with a focus on SQL unit testing. If any unit test returns fail, we can automatically cancel the deployment process.
On the other hand, when we look at unit testing in terms of continuous integration and continuous development approach, the entire application code can be tested before the production deployment process with help of unit test methods.
In modern software development approaches, unit testing plays a key-role because unit tests directly affects code quality. Unit testing is used to check basis functionality and behavior of the smallest and independent part (function, method or etc.) of the code blocks that performs certain operations. In particular, this article will focus about unit test theory in terms of SQL Server database development aspect and illustrate SQL unit testing with a detailed example.
In this article, we will discuss the essentials of the SQL unit testing and then we will explore how to apply SQL unit testing methodology in Azure SQL Database with help of SQL Server Data Tools (SSDT).