How can we help you today? How can we help you today?

How can I exclude the system stored procedures for diagrams from Code coverage results?

I have recently noticed that the sp_%diagram procedures are now being listed in the Code coverage results, but they didn't use to.

They all have an extended property of microsoft_database_tools_support, which could be an easy way to identify them.
Is there a way to exclude these from the results of the Code coverage? 
DLyes
0

Comments

7 comments

  • Alex B
    Hi @DLyes,

    I can see severa parts in the static analysis code base where it's looking for objects but excluding diagram related things like:
    <div>Where	SPECIFIC_NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AI LIKE 'sp[_]%'</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And SPECIFIC_NAME COLLATE SQL_LATIN1_GENERAL_CP1_CI_AI NOT LIKE '%diagram%'</div>
    And
    AND name Not In('sp_helpdiagrams','sp_upgraddiagrams','sp_creatediagram')
    And
    And TABLE_NAME <> 'sysdiagrams'
    So it seems like it is excluding them in at least some cases.  Can you give specific example of what and where it is being included?

    Kind regards,
    Alex
    Alex B
    0
  • DLyes
    Thanks for the reply Alex, sorry this reply took so long.

    What you've mentioned above sounds like it should exclude most of them, but it doesn't line up with what I can see.

    When I run my tests on a database which has the diagramming objects, these ones show up in the Code coverage section.

    [dbo].[sp_upgraddiagrams] 7 0 0.00
    [dbo].[sp_helpdiagrams] 5 0 0.00
    [dbo].[sp_helpdiagramdefinition] 16 0 0.00
    [dbo].[sp_creatediagram] 21 0 0.00
    [dbo].[sp_renamediagram] 25 0 0.00
    [dbo].[sp_alterdiagram] 24 0 0.00
    [dbo].[sp_dropdiagram] 16 0 0.00
    [dbo].[fn_diagramobjects] 19 0 0.00

    I am using the latest available version - SQL Test Version 3.1.3.585
    DLyes
    0
  • Alex B
    Hi @DLyes,

    Righto, the bits I saw were related to some of the SQL Cop static analysis tests rather than code coverage.

    The code coverage is handled by SQL Cover which is this open source project: https://github.com/GoEddie/SQLCover and so you will need to direct questions or requests for it there as we don't control it!

    Kind regards,
    Alex
    Alex B
    0
  • DLyes
    Thanks for confirming that @Alex B. 
    DLyes
    0
  • Alex B
    No worries, sorry I couldn't help more!
    Alex B
    0
  • DLyes
    Hello, 

    I came across the need for this again this week, and posted it as an issue on the SQLCover github page.

    Eddie replied confirming that SQLCover already has the ability to take a filter to exclude specific objects ("sp_.*diagram" would work in this instance) but there is nothing in the SQLTest ui to allow you to specify anything that can be passed to SQLCover.

    Is this something which could be added to SQLTest?

    Link to GitHub comment : https://github.com/GoEddie/SQLCover/issues/45#issuecomment-548136446

    DLyes
    0
  • Azhkanizkael
    If this isn't going to get added any time soon, could we at least get a guide of how to update the SQLCover ourselves?
    Azhkanizkael
    0

Add comment

Please sign in to leave a comment.