Internal framework table used in our continuous integration process to track what files (unit test files in particular) were loaded.

Our internal convention is to use one separate file for each unit test or any any unit test helper object, that allows us to verity if all existing in files  unit tests and supporting object were compiled successfully  

 

NOTE: available starting 4.5.20 framework version

Column Name Data Type Description
FileID INT Unique file identification number. IDENTITY column 
ExternalID VARCHAR(250) External identification number. We are using the build number in this column.
FullFileName NVARCHAR(MAX) Full file name
FileName NVARCHAR(MAX) Short file name with three (3) letter extension. I our case it is for instance "UT_DNTD_MyUnitest.sql"
LoadTime DATETIME Date and time when file were loaded (or not) into a database

 

Examples

SQL Server

USE DBTestDriven

GO

--****************************************************************************
EXEC DBTD_DROP_PROC_IF_EXISTS 'UT_INTEGRATION_CheckThatAllUnitTestssAreLoaded'
GO

--****************************************************************************
--verifies that all unit test files are loaded run by the framework
--EXEC UT_INTEGRATION_CheckThatAllUnitTestssAreLoaded @v_Debug = 1
CREATE PROC UT_INTEGRATION_CheckThatAllUnitTestssAreLoaded
    @v_Debug INT = 0 --we do want to know all exceptions for this unit test
AS
BEGIN
    EXEC DBTD_UNIT_TEST 'INTEGRATION'

    CREATE TABLE #Exclusions(
      Name   VARCHAR(1000),
      ExclusionReason VARCHAR(MAX)
    )

    INSERT INTO #Exclusions (Name, ExclusionReason)
      EXEC UTT_DBTD_FileLoadingObjectExclusions

    ;WITH
      CTE_LoadedObjects (ObjectName) AS
        (
        SELECT LEFT(FileName, LEN(FileName)-4) AS ObjectName
        FROM DBTD_TBL_LoadStatisticsTable
        ),
      CTE_FilesLoadedNoExclusions (ObjectName) AS
        (
        SELECT distinct ObjectName
        FROM CTE_LoadedObjects lo
         LEFT OUTER JOIN #Exclusions e
          ON lo.ObjectName = e.Name
        WHERE e.Name IS NULL
        )
    SELECT
      ObjectName,
      tl.TestName
    INTO #Issues
    FROM CTE_FilesLoadedNoExclusions l
      FULL OUTER JOIN DBTD_TBL_TESTRESULT tl --DBTD_TBL_TESTSLIST tl
       ON l.ObjectName = tl.TestName
    WHERE tl.TestName is NULL
      OR ObjectName IS NULL

    IF @v_Debug = 1
    BEGIN
      SELECT '#Issues', * FROM #Issues
    END
    IF @v_Debug = 2
    BEGIN
      PRINT 'And now check Issues ********************************************'
      SELECT '#Issues', * FROM #Issues
      PRINT 'And now check Exclusions ****************************************'
      SELECT '#Exclusions', * FROM #Exclusions
      PRINT 'And now check DBTD_TBL_LoadStatisticsTable **********************'
      SELECT 'DBTD_TBL_LoadStatisticsTable', * FROM DBTD_TBL_LoadStatisticsTable
    END


    EXEC DBTD_ASSERT_TABLE_HAS_NO_RECORDS '#Issues', 'AHTUNG. AHTUNG. AHTUNG. We should have no exceptions!'


END
GO