When this hint procedure found anywhere in the body of the stored procedure, such stored procedure will be identified by framework as THE Unit Test. Unit Test can belong to only one Test Suite. 

Note: In cases when stored procedure is named using legacy naming convention "UT_SuiteName_TestName" and at the same time uses DBTD_UNIT_TEST hint procedure, the DBTD_UNIT_TEST logic will take precedence over legacy convention.

Note: Always use DBTD_UNIT_TEST hint procedure when working with pretend object.

Arguments

  • v_TestSuite – name of the Test Suite that this unit test will belong too, SYSNAME. This is required parameter, If Suite Name has not been specified, were set to be EMPTY string or a variable value then such test will be placed under 'GenericUnitTests' suite.

 

Examples

SQL Server

Different ways to use the hint

EXEC DBTD_UNIT_TEST ''; --will be identified under GenericUnitTests test suite 
EXEC DBTD_UNIT_TEST @SuiteName; --will be identified under GenericUnitTests test suite 
EXEC DBTD_UNIT_TEST 'Client Logic Implementation Checks';  --will be identified under 'Client Logic Implementation Checks' test suite 

Sample of unit test procedure in the "Check Orders" test suite:

CREATE PROCEDURE [Unit Tests that verifies business logic]
AS
BEGIN
   EXEC DBTD_UNIT_TEST 'Check Orders';

   EXEC DBTD_ASSERT_TABLE_EXISTS 'MyDatabase.MySchema.MyTable', 'could not find a table';
END;
GO

 
 

See Also