Tests: Add Codecov Test Analytics support#7
Merged
ScarletKuro merged 2 commits intomasterfrom Jan 16, 2026
Merged
Conversation
Co-authored-by: ScarletKuro <19953225+ScarletKuro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for codecov test analytics
Add Codecov Test Analytics support
Jan 16, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7 +/- ##
=======================================
Coverage 92.30% 92.30%
=======================================
Files 13 13
Lines 156 156
Branches 35 35
=======================================
Hits 144 144
Misses 7 7
Partials 5 5 ☔ View full report in Codecov by Sentry. |
ScarletKuro
approved these changes
Jan 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables Codecov Test Analytics to track test results, failures, and trends across CI runs.
Changes
JunitXml.TestLoggerv4.1.0 to generate JUnit XML reportsTesttarget to output JUnit XML toartifacts/test-results/alongside existing coverage reportscodecov/test-results-action@v1step to upload test results with!cancelled()condition to capture failuresImplementation
JUnit logger configured inline with
dotnet test:Test results upload in CI after test execution:
Original prompt
Add support for codecov "Test Analytics"
The documentation show this steps:
The only thing is that there is no native support for the
JUnit Reportand NUnit to suggest doing it this way (keep in mind this example is for CI Insights not codecov):This guide shows how to generate JUnit reports from your NUnit tests and upload them to CI Insights using a GitHub Actions workflow.
Generate a JUnit Report with NUnit
Section titled Generate a JUnit Report with NUnit
NUnit can generate JUnit-compatible XML reports using the built-in test adapter and various loggers available for dotnet test.
Using dotnet test with JUnit Logger
Section titled Using dotnet test with JUnit Logger
Install the JUnit test logger:
dotnet add package JunitXml.TestLogger
Run tests with JUnit output:
dotnet test --logger "junit;LogFilePath=junit.xml"
Using NUnit Console Runner
Section titled Using NUnit Console Runner
If you’re using the NUnit Console Runner directly:
nunit3-console.exe your-test.dll --result=junit.xml;format=junit
Using NUnit Test Adapter
Section titled Using NUnit Test Adapter
Add the NUnit test adapter to your test project:
Then run:
dotnet test --logger junit
Using Multiple Test Result Formats
Section titled Using Multiple Test Result Formats
You can generate multiple formats simultaneously:
dotnet test --logger "console;verbosity=detailed" --logger "junit;LogFilePath=junit.xml" --logger "trx;LogFileName=results.trx"
Using NUnit with Custom Settings
Section titled Using NUnit with Custom Settings
You can also configure test settings in a .runsettings file:
junit.xmlThen run:
dotnet test --settings test.runsettings
Update Your GitHub Actions Workflow
Section titled Update Your GitHub Actions Workflow
Note
Ensure your application key with ci scope (MERGIFY_TOKEN) is set up as explained in the installation docs.
After generating the JUnit report, add a step to upload the results to CI Insights using the mergifyio/gha-mergify-ci action.
For example, in your workflow file:
name: Run NUnit Tests and Generate JUnit Report
continue-on-error: true
run: dotnet test --logger "junit;LogFilePath=junit.xml"
name: Mergify CI Upload
if: success() || failure()
uses: mergifyio/gha-mergify-ci@v8
with:
token: ${{ secrets.MERGIFY_TOKEN }}
report_path: junit.xml
Key Points:
If you use a job matrix in your workflow (e.g., to test across multiple versions), ensure you set the job_name input (or MERGIFY_JOB_NAME environment variable) so CI Insights can properly distinguish reports for each matrix job.
For example, with:
jobs:
example_matrix:
strategy:
matrix:
version: [10, 12, 14]
Your upload step should look like:
if: success() || failure()
uses: mergifyio/gha-mergify-ci@v8
with:
job_name: example_matrix (${{ matrix.version }})
token: ${{ secrets.MERGIFY_TOKEN }}
report_path: junit.xml
Did you know?
Setting job_name helps CI Insights group and display reports correctly for each matrix variation.
In order to benefit from CI Insights Quarantine, you need to add continue-on-error: true in your GitHb Actions step that execute your tests and generat...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.