GoEddie / SQLCover

Apache License 2.0
63 stars 53 forks source link

SQLCover filters out the SP that has index created on table variable #74

Open priyasomangali opened 3 years ago

priyasomangali commented 3 years ago

Hi @GoEddie ,

I have SP that has the below declaration with index .

CREATE  PROCEDURE [dbo].[my_procedure_v1]
AS
BEGIN
    SET NOCOUNT ON
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTE
DECLARE @user TABLE (
      [name] [varchar](20) NULL,
      [age] [int ] NULL,
      [ssn] [varchar](20) NOT NULL
      PRIMARY KEY (ssn),
      INDEX  IX01 (name,age,ssn)
)
//DO SOMETHING
END

I am executing tsqlt tests via sqlcover , Get-CoverTSql ".\SQLCover.dll" "server=localhost,XXX;User ID=****;Password=******" "db_name" "exec tsqlt.RunAll" -o TestCover

 function Get-CoverTSql{
    param(
        [string]$coverDllPath
    ,[string]$connectionString
    ,[string]$databaseName
    ,[string]$query
    )
    if(!(Test-Path $coverDllPath)){
        Write-Error "SQLCover.dll path was not found ($coverDllPath)"
        return
    }

    Add-Type -Path $coverDllPath

    $coverage = new-object SQLCover.CodeCoverage ($connectionString, $databaseName)
    $coverage.Cover($query)
}

However when I check the xml report generated , the SP (my_procedure_v1 in this case), doesn’t appear . But when I remove the INDEX that I have on the TABLE variable, it comes up in the xml report. Could you please help guide what is the issue here ? Why is SQLCover filtering out the SP. This is a blocker for us as we have bunch of SP that has a similar pattern.

Thanks, Priya