Unit Testing for SQL Server Database Projects with Visual Studio
6.7 هزار بار بازدید -
5 سال پیش
-
Learn database testing concepts, database
Learn database testing concepts, database testing basics and how to perform database testing manually with this database testing tutorial with examples in SQL Serve
================The Database Table =================
==============The Sample Stored Proc=================
create proc entrytest
(
@id Int = NULL ,
@Name VARCHAR(50) = NULL ,
@City VARCHAR(50) = NULL
)
as
INSERT INTO emptb1
VALUES
(
@id ,
@name ,
@city
)
go
==============Run Stored Proc=================
exec entrytest
@id =1 ,
@Name ='Peter' ,
@City ='pune'
go
============ The Unit test ( Test Condition = Row Count = 0 and later 1)=====
DECLARE @RC AS INT, @id AS INT, @Name AS VARCHAR (50), @City AS VARCHAR (50);
SELECT @RC = 0,
@id = 3,
@Name = 'peter',
@City = 'pune';
EXECUTE @RC = [dbo].[entrytest] @id, @Name, @City;
SELECT @RC AS RC;
============ The Unit test ( Pre Test Condition = No Condition)=====
delete from dbo.emptb1 where id=3
============ The Unit test ( Post Test Condition =Row Count = 1)=====
select * from dbo.emptb1 where id= 3
================The Database Table =================
==============The Sample Stored Proc=================
create proc entrytest
(
@id Int = NULL ,
@Name VARCHAR(50) = NULL ,
@City VARCHAR(50) = NULL
)
as
INSERT INTO emptb1
VALUES
(
@id ,
@name ,
@city
)
go
==============Run Stored Proc=================
exec entrytest
@id =1 ,
@Name ='Peter' ,
@City ='pune'
go
============ The Unit test ( Test Condition = Row Count = 0 and later 1)=====
DECLARE @RC AS INT, @id AS INT, @Name AS VARCHAR (50), @City AS VARCHAR (50);
SELECT @RC = 0,
@id = 3,
@Name = 'peter',
@City = 'pune';
EXECUTE @RC = [dbo].[entrytest] @id, @Name, @City;
SELECT @RC AS RC;
============ The Unit test ( Pre Test Condition = No Condition)=====
delete from dbo.emptb1 where id=3
============ The Unit test ( Post Test Condition =Row Count = 1)=====
select * from dbo.emptb1 where id= 3
5 سال پیش
در تاریخ 1398/09/15 منتشر شده
است.
6,710
بـار بازدید شده