I like this solution the most because it's very flexible and doesn't require additional installations on sql server.
Also I think the best way to write sql unit tests is to make them independent from data.And validate logic but not data.
Such unit tests can be run on development or qa and even production environment.
--Unit Test example
--SETUP
declare @ActualData varchar(10) , @ExpectedResult varchar(10)
-- RUN
SET @ActualData ='a'
Set @ExpectedResult ='b'
-- VALIDATE
IF @ActualData!= @ExpectedResult
RAISERROR('>> Unit Test FAILED: Returned data doen''t match expected: %s instead of %s ', 11, 0, @ActualData ,@ExpectedResult )
Also there are another sql unit test frameworks .
No comments:
Post a Comment