Incorrect SQL Test code coverage

AthiAthi Posts: 2 New member
edited October 9, 2019 5:27PM in SQL Test
After Running a unit test case, I get a code coverage of ~70% for a single stored procedure. But while running all the unit tests together gives 0 % coverage for the same stored procedure. Please give me ideas/suggestions on this issue.

Best Answer

  • Alex BAlex B Posts: 1,158 Diamond 4
    Hi @Athi,

    This sounds like an issue we've seen before where if there are a large number of tests, it unfortunately causes the extended events trace to roll over into a new file. 

    This can cause SQL Server to lose some object ids (see https://github.com/GoEddie/SQLCover/issues/5 - closed erroneously by the project owner) This would cause some files to erroneously have zero code coverage. It also explains why running them individually would run correctly.

    As to what to do about it, I'm not sure unfortunately. It would need SQL Cover to implement some sort of workaround around increasing the max_file_size when creating the event session, but we only utilize SQL Cover rather than owning it I'm afraid.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Answers

Sign In or Register to comment.