Comments (6)
I got the original error again with 0.4.1 and 0.5.0
Code:
# https://stackoverflow.com/questions/9948517/how-to-stop-a-powershell-script-on-the-first-error
$ErrorActionPreference = "Stop"
cd c:\Users\hoffman\Documents\Apps\SQLcover
# https://the.agilesql.club/2016/04/sqlcover-code-coverage-for-sql-server-t-sql/
$coverPath='C:\Users\hoffman\Documents\Apps\SQLCOver-0.5.0'
$coverPS1="$coverPath\SQLCover.ps1"
$coverDLL="$coverPath\SQLCover.dll"
$server='GTR_DEV16'
$database='GTR'
$SQLuser='gtr_write'
$SQLpass='removed'
$query="EXEC tSQLt.Run 'zut_clinvar_sub_curation.Test_update_sub_date'"
$connectionString = "User ID=$SQLuser;Password=$SQLpass;database=$database;Server=$server;"
Unblock-File -Path $coverDll
Add-Type -Path $coverDll
. $coverPS1
$coverage = new-object SQLCover.CodeCoverage ($connectionString, $database, $null, $true)
$result = $coverage.Cover($query)
Export-OpenXml $result "testout.xml"
Output
.\short_test.ps1
Starting Code Coverage
Starting Code Coverage...Done
Executing Command: EXEC tSQLt.Run 'zut_clinvar_sub_curation.Test_update_sub_date'
Executing Command: EXEC tSQLt.Run 'zut_clinvar_sub_curation.Test_update_sub_date'...done
Stopping Code Coverage
Exception calling "Cover" with "1" argument(s): "Exception gathering the results"
At C:\Users\hoffman\Documents\Apps\SQLcover\short_test.ps1:19 char:1
+ $result = $coverage.Cover($query)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : SqlCoverException
Adding a second argument, 0, didn't help.
from sqlcover.
Hi,
For the debug output run this:
$coverage = new-object SQLCover.CodeCoverage ($connectionString, $databaseName, $null, $true)
$coverage.Cover($query)
so for your script run:
# file: test.ps1
$ErrorActionPreference = "Stop"
cd c:\Users\hoffman\Documents\Apps\SQLcover
# https://the.agilesql.club/2016/04/sqlcover-code-coverage-for-sql-server-t-sql/
$coverPath='C:\Users\hoffman\Documents\Apps\SQLCOver.0.4.1'
$coverDLL="$coverPath\SQLCover.dll"
$coverPS1="$coverPath\SQLCover.ps1"
# osql and osqlArgs used for Get-CoverExe
$osql='C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\OSQL.EXE'
$server='GTR_DEV16'
$database='GTR'
$SQLuser='gtr_write'
$SQLpass='removed' #
$query="EXEC tSQLt.Run 'zut_clinvar_sub_curation.Test_update_sub_date'"
$connectionString = "Persist Security Info=False;User ID=$SQLuser;Password=$SQLpass;Initial Catalog=$database;Server=$server"
$osqlArgs="-S $server -d $database -U $SQLuser -P $SQLpass -i test.sql"
. $coverPS1
#$result = Get-CoverTSql "${coverDLL}" "${connectionString}" "${database}" "${query}"
#$result = Get-CoverExe "${coverDLL}"
$coverage = new-object SQLCover.CodeCoverage ($connectionString, $database, $null, $true)
$result = $coverage.Cover($query)
Can you tell me the error?
ed
from sqlcover.
Thank you for your response. I had another error which I reported and have since deleted because it was an unrelated internal problem. Disregard whatever email was generated as a result. I apologize for the inconvenience.
from sqlcover.
Hi,
no problem - can you clarify what error you get now?
There is also a newer release 0.5.0 which has a number of big fixes, probably worth testing with:
https://github.com/GoEddie/SQLCover/releases/tag/0.5.0
from sqlcover.
I am having permission issues and working with our DBA. Thanks for letting me know about the new version.
from sqlcover.
@ncbidoug I would try the SQLCoverCore project using dotnet core 3.1. You can also use the debugger in visual studio code to track down your issue. I think correcting your powershell script would take more time than using the easier dll.
Example using dotnet core:
cd src/SQLCover/SqlCoverCore
mkdir -p TestCoverageOpenXml
dotnet run -- -c Get-CoverTSql -e Export-OpenXml -k "Server=localhost;Database=master;User ID=sa;Password=JdMsKZPBBA8kVFXVrj8d" -d DatabaseWithTests -q "tSQLt.runAll" -o TestCoverageOpenXml
you can also call the new dll directly, (not to be confused w/ the one targeting .net461
cd src/SQLCover/SqlCoverCore
dotnet build
.\bin\Debug\netcoreapp3.1\SQLCoverCore.exe -c Get-CoverTSql -e Export-OpenXml -k "Server=localhost;Database=master;User ID=sa;Password=JdMsKZPBBA8kVFXVrj8d" -d DatabaseWithTests -q "tSQLt.runAll" -o TestCoverageOpenXml
# or
dotnet run .\bin\Debug\netcoreapp3.1\SQLCoverCore.dll -- -c Get-CoverTSql -e Export-OpenXml -k "Server=localhost;Database=master;User ID=sa;Password=JdMsKZPBBA8kVFXVrj8d" -d DatabaseWithTests -q "tSQLt.runAll" -o TestCoverageOpenXml
from sqlcover.
Related Issues (20)
- add topic hacktoberfest
- Postgres, mysql support HOT 3
- dotnet core tool published
- Support SQL Server inline table valued functions? HOT 1
- Cannot use or export using Cobertura on CoverageResult HOT 1
- Generating partial test coverage report for the Azure DB. HOT 4
- Default Tracing error with SQLLocalDB datasource based on Windows named pipe line HOT 2
- Publish Coverage Results in Azure DevOps HOT 1
- Exception running code coverage: Unable to cast object of type 'System.DBNull' to type 'System.String' HOT 1
- How to exclude database objects from coverage reports? HOT 4
- SQLCover filters out the SP that has index created on table variable
- News about release 0.6 or what's next? HOT 1
- Allign to the OpenCover format https://github.com/csMACnz/coveralls.net is using
- download link broken
- Cobertura updates/adherence HOT 1
- Missing max_rollover_files option in definition of event session target file leads to lost of coverage info HOT 1
- Question: Is it possible to run SQLCover on Linux? HOT 1
- Unable to generate code coverage on database hosted on linux docker container HOT 1
- Is this project no longer maintained? HOT 2
- GitHub action jobs currently failing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlcover.