-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Exception calling "Cover" with "1" argument(s) - also "2" arguments. #44
Comments
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 |
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. |
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: |
I am having permission issues and working with our DBA. Thanks for letting me know about the new version. |
I got the original error again with 0.4.1 and 0.5.0
Output
Adding a second argument, 0, didn't help. |
@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 |
Do you want to request a feature or report a bug?
bug or help
What is the current behavior?
I am getting the following when calling Get-CoverTSql. Where is the debug output?
Also tried using Get-CoverExe and is got an error message from
OSQL.EXE
indicating that I didn't set up the arg list correctly. The relevant line is commented out below.Server version:
Microsoft SQL Server 2017 (RTM-CU15) (KB4498951) - 14.0.3162.1 (X64) May 15 2019 19:14:30 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Datacenter 6.3 (Build 9600: ) (Hypervisor)
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via http://sqlfiddle.com/
What is the expected behavior?
Not receiving an error message
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Microsoft SQL Server 2017 (RTM-CU15) (KB4498951) - 14.0.3162.1 (X64) May 15 2019 19:14:30 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Datacenter 6.3 (Build 9600: ) (Hypervisor)
Client desktop computer: Windows 10 Enterprise
Version 1806 (OS Build 17134.1006)
First time attempting to use SQLCover.
The text was updated successfully, but these errors were encountered: