SteveGilham / altcover

Cross-platform coverage gathering and processing tool set for dotnet/.Net Framework and Mono
MIT License
494 stars 17 forks source link

Per-test level code coverage #224

Closed mcintyre321 closed 1 month ago

mcintyre321 commented 1 month ago

Hi, I was wondering if altcover supports generating per-test level code coverage reports? We're looking for this feature so we can instrument our integration tests and only run those which don't touch any changed code.

thanks!

SteveGilham commented 1 month ago

The --callContext option tags visits according to the call stack, as a generalization of the OpenCover -coverbytest; a sequence point record will look like

                <SequencePoint vc="2" uspid="0" ordinal="0" offset="0" sl="8" sc="23" el="8" ec="28" bec="0" bev="0" fileid="1">
                  <Times />
                  <TrackedMethodRefs>
                    <TrackedMethodRef uid="5" vc="1" />
                    <TrackedMethodRef uid="6" vc="1" />
                  </TrackedMethodRefs>
                </SequencePoint>

with the tracked methods similarly having records like

        <TrackedMethod uid="5" token="100663319" name="System.Void Tests.Problematic::Thing Rectangle()" strategy="[Test]" entry="638513019427084217" exit="638513019427193380" />

The <Times /> record is a generalization that records wall-clock time of visit, when requested, for the purpose of determining visits by test during scripted or manual operational test runs.

SteveGilham commented 1 month ago

Assuming silence as assent, closing.