I'm presently baffled by the same command, on the same code, with the same dotnet version, producing two different results. My development machine is an ARM-based Mac, and CI is in a Docker image run from Bamboo on a CentOS host.
Test coverage command
dotnet test --filter Category!=LocalOnly --collect:"XPlat Code Coverage"
Dockerfile for build plan
The Python installation is because I'm using pycobertura to analyze the coverage results
FROM mcr.microsoft.com/dotnet/sdk:7.0
WORKDIR /app
ENV HOME="/home"
ENV PATH="$PATH:$HOME/.dotnet/tools"
RUN dotnet tool install -g dotnet-reportgenerator-globaltool
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip install pycobertura
RUN pip install requests
RUN dotnet --version
Version numbers
- dotnet: 7.0.304
- xunit: 2.4.2
- coverlet.collector: 6.0.0
For the one file with partial coverage, the reported line coverage drops from 100% (Mac) to 66.67% (CI), and the branch coverage drops from 75% (Mac) to 0.00% (CI).
What should I do in order to figure out what's going on? To be clear, it's tough to say either environment is right/wrong at this point, but I'm not sure how to troubleshoot this, and my build plan verifies coverage level, so I'm stuck for now. Could it be an ARM/x64 difference somehow? That doesn't seem likely.