STUB is the copy of original procedure that has the same signature and intended to be used side by side with original. STUB procedure have following qualities:

  • stub will have same signature as original procedure, including parameter default values and direction for output parameters
  • stub will have different name than original procedure
  • STUB will only run the code that specified in the v_StubSQL parameter 
  • stub will record information about each procedure call, together with the supplied parameter values for each individual procedure execution. Data will be stored in the DBTD_TBL_PRETEND_OBJECT_LOG and DBTD_TBL_PRETEND_OBJECT_PARAM_LOG tables
  • error will occur if database already have procedure with the name specified in the v_StubProcName parameter
  • error occur if database does not have original procedure with the name specified in the v_OriginalProcName parameter
  • DBTestDriven framework will truck stub execution for each individual unit test run





  • v_StubProcName - The name of the STUB procedure that will be created base on the same signatuare as in the @v_OriginalProcName. This can be fully qualified name with database.schema.object. Parameter type SYSNAME.
  • v_OriginalProcName - The name of the original procedure, the signature of this stored provedure will be used to create this Stub store dproc. This can be fully qualified name with database.schema.object. Parameter type SYSNAME.
  • v_StubSQL - Is a unicode string that contains a Transact-SQL statement. NULL is default, means that extra code will not be executed besides framework logging.

Note: SQL Server only


SQL Server

                          @v_StubProcName = 'sp_stub_for_GetAllProduct',
                          @v_OriginalProcName = 'sp_GetAllProduct',
                          @v_StubSQL =  'SELECT * FROM TestProducts'


See Also