Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating partial test coverage report for the Azure DB. #66

Open
Riddhish84 opened this issue Dec 8, 2020 · 4 comments
Open

Generating partial test coverage report for the Azure DB. #66

Riddhish84 opened this issue Dec 8, 2020 · 4 comments

Comments

@Riddhish84
Copy link

Riddhish84 commented Dec 8, 2020

Describe the bug
I have run the Power shell for SQL coverage report for Azure DB, it shows me partial sqlunit test coverage as well and some time it is covering more or less test cases. I wrote SQL Unit Tests with SQL Server Data Tools.

To Reproduce

I have made script to run all azure test cases and to get sql cover report.


$coverDllPath =  "C:\Downloads\SQLCover-0.5.0\SQLCover-0.5.0\src\SQLCover\releases\template\SQLCover.dll"

$connectionString = "Server=server_name;Database=db_name;Persist Security Info=False;User ID=master;Password=pa$$word;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
$databaseName = "db_name"


$outputPath ="C:\Downloads\SQLCover-0.5.0\SQLCover-0.5.0\src\SQLCover\releases\template\result"


if(!(Test-Path $coverDllPath)){
Write-Error "SQLCover.dll path was not found ($coverDllPath)"
return
}

Unblock-File -Path $coverDllPath
   
Add-Type -Path $coverDllPath
    
$coverage = new-object SQLCover.CodeCoverage ($connectionString, $databaseName)

$coverage.Start()

# Run all test cases .
mstest.exe /testcontainer:C:\Project\test_project\bin\Debug\RamSoft.AzureSQL.Test.dll

$result = $coverage.Stop() 

$xmlPath = Join-Path -Path $outputPath -ChildPath "Coverage.html"
    $result.Html() | Out-File $xmlPath
    $result.SaveSourceFiles($outputPath) 

Snapshot
image
image

As you can see only I have test cases which executes more than 1000 statements but it covers partially.

Expected behavior
Should cover all the statements of the test cases

Additional context

I am using latest version of SQLCover i.e. 0.5.0.
I unlocked the SQLcover.dll as well.
It run all the test cases means it is trigger the statements. But not covered all of them while generating cover report.
I have also tried with CoverExe function but it gave same result for me.
I have also tried to increase timeout, but it had same results

Please @GoEddie help me to solve this issue.

@lowlydba
Copy link

Looks like a dup of #51

@Riddhish84
Copy link
Author

I think in #51, 0 line covered for azure sql but in this scenario we have partial coverage report.

@lowlydba
Copy link

It varies if you do enough testing, most likely the same problem.

@umeshsolanki19
Copy link

umeshsolanki19 commented Nov 18, 2022

Hi @GoEddie,
I am also facing same issue(coverage report is showing 0 line coverage and sometime showing partial coverage) with Azure SQL database and I think it's an existing issue with SQLCover for Azure Sql database. Could you please share some workaround for this issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants