Incorrect SQL Test code coverage
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 B Posts: 1,158 Diamond 4Hi @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
Answers