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

How to exclude database objects from coverage reports? #72

Closed
KrylixZA opened this issue Jun 17, 2021 · 4 comments
Closed

How to exclude database objects from coverage reports? #72

KrylixZA opened this issue Jun 17, 2021 · 4 comments

Comments

@KrylixZA
Copy link

Hey @GoEddie :)

Thanks for this awesome library. I am running some tests against our DB in a Docker container in a CI pipeline and while there's nothing necessarily wrong, I am trying to figure out how to exclude objects from coverage. There appears to be little (to possibly no) documentation no how to do the exclusions correctly?

The SQLCover.CodeCoverage (PowerShell) has a couple of options, the one I am interested is:
New-Object SQLCover.CodeCoverage($connectionString, $DbName, $ObjectFilters, $DebugLogging)

It seems to support the notion of filtering out objects but I actually don't know how to do this 😢

Any help would be nice.

In particular, I have two schemas on my DB:

  • dbo
  • Versioning

I would like to exclude the Versioning schema from coverage.

@KrylixZA KrylixZA changed the title How to use object filters? How to exclude database objects from coverage reports? Jun 17, 2021
@priyasomangali
Copy link

Hi @GoEddie ,

I am also looking to tackle similar issue reported above. My usecase is to exclude a list of stored procedures for which I Know I will not write unit tests. In that scenario, I would want to exclude those in the total coverage metrics as well. Could you help suggest if this is possible in the existing version ?

Thanks,
Priya

@priyasomangali
Copy link

Hello @KrylixZA ,

Were you able to find any solution for the issue you have reported ? Please let me know if you have found something.

Thanks,
Priya

@priyasomangali
Copy link

hi @KrylixZA ,

Found a working solution where sql objects can be excluded from coverage.

$excludeArray = “\[dbo\].\[sp_sysproc1\]","\[dbo\].\[sp_sysproc2\]” $coverage = new-object SQLCover.CodeCoverage($connectionString, $database, $excludeArray, $logging)

Referece : https://the.agilesql.club/2016/04/sqlcover-code-coverage-for-sql-server-t-sql/

Thanks

@KrylixZA
Copy link
Author

KrylixZA commented Jan 3, 2024

hi @KrylixZA ,

Found a working solution where sql objects can be excluded from coverage.

$excludeArray = “\[dbo\].\[sp_sysproc1\]","\[dbo\].\[sp_sysproc2\]” $coverage = new-object SQLCover.CodeCoverage($connectionString, $database, $excludeArray, $logging)

Referece : https://the.agilesql.club/2016/04/sqlcover-code-coverage-for-sql-server-t-sql/

Thanks

Closing this issue with this comment. Thanks @priyasomangali 👍

@KrylixZA KrylixZA closed this as completed Jan 3, 2024
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

2 participants