How to Generate NUnit Test Reports
Generate NUnit test reports by choosing the right runner and format: native NUnit XML, VSTest TRX or HTML, or Microsoft.Testing.Platform extensions.
To generate an NUnit test report, first identify how the project runs its tests. Use the NUnit Console Runner for native NUnit XML; use the documented TRX or HTML logger with VSTest-based dotnet test; or install the report extension for Microsoft.Testing.Platform (MTP). These routes produce different artifacts, and their command-line options are not interchangeable.
Choose the output format your CI service or downstream tool accepts. NUnit XML is useful for NUnit-aware processing, TRX for Visual Studio test-result workflows, and HTML when you need a browsable report. The official NUnit Console Runner documentation describes the runner as a command-line tool for listing and running tests.
1. Identify your test runner
Check the existing build command and project configuration before changing anything. NUnit tests can run through the NUnit Console Runner or through Microsoft tooling using NUnit3TestAdapter. MTP has its own reporting extensions. Match the example below to the route already used by the project.
| What you need | Route | Typical artifact |
|---|---|---|
| NUnit-native results for processing | NUnit Console Runner | NUnit 3 XML |
| Results accepted by Visual Studio-oriented CI tooling | VSTest-based dotnet test |
TRX |
| A standalone human-readable report from VSTest | VSTest-based dotnet test |
HTML |
| An MTP-based test app | Microsoft.Testing.Platform | TRX or HTML via installed extensions |
Before selecting a format, answer four questions: which runner is already in use, what formats the CI or report consumer accepts, whether readers or software consume the artifact, and whether each target framework needs a separate file.
2. Generate native NUnit XML with the Console Runner
The Console Runner saves XML results automatically. If neither --result nor --explore is specified, its documented default is TestResult.xml in NUnit 3 format. Set --result explicitly when you need a predictable filename or format.
nunit3-console MyTests.dll --result=TestResult.xml;format=nunit3
The result option accepts an output specification with an optional format or XSLT transform. For a legacy NUnit 2 XML result, choose nunit2:
nunit3-console MyTests.dll --result=TestResult.xml;format=nunit2
A transform is a separate presentation step: the transform must handle native NUnit 3 XML. Do not describe the XML artifact itself as an HTML report. Use --work to choose the Console Runner working directory for generated output.
nunit3-console MyTests.dll --work=./artifacts --result=./artifacts/TestResult.xml;format=nunit3
Shells may interpret semicolons. Quote or escape the result argument when needed by your shell. The exact quoting syntax depends on the shell; the examples here show the option value itself.
See the official Console command-line options and Console Runner guide for the supported syntax and formats.
3. Generate TRX or HTML with VSTest-based dotnet test
For a project using the VSTest-based dotnet test route, Microsoft documents these logger commands:
# TRX result
dotnet test --logger trx
# HTML report
dotnet test --logger "html;logfilename=testResults.html"
For a clean copy-paste command, remove the leading space before dotnet on each line if your shell treats it specially. You can set a results directory with --results-directory. When omitted, the documented default is a TestResults directory beside the project file.
dotnet test --logger trx --results-directory ./artifacts/TestResults
You can also choose a TRX filename:
dotnet test --logger "trx;LogFileName=results.trx" --results-directory ./artifacts/TestResults
For multi-targeted projects, Microsoft documents that a specified identical TRX logfilename is reused for each target framework. Later output may overwrite an earlier target’s artifact. Use the documented LogFilePrefix pattern or another unique naming strategy if you need to retain every target’s result. Check the dotnet test documentation for current logger and filename syntax.
When Microsoft tools run NUnit tests, NUnit3TestAdapter is part of the execution path. The adapter can separately produce NUnit Test Result XML through its TestOutputXml settings. That XML is distinct from TRX or HTML generated by a VSTest logger. Pick based on what consumes the artifact, and verify adapter version before relying on a setting whose availability can vary by version. See the NUnit adapter documentation.
4. Generate reports with Microsoft.Testing.Platform
MTP uses report extensions rather than the VSTest logger interface. Microsoft lists TRX and HTML report routes, but report support is not part of MTP core: install and register the extension that provides the format you need, then use that extension’s options for the output name and location.
If --report-trx or another report option is unrecognized, the relevant extension may be missing or unregistered. Check the test app’s --help output or dotnet test --help in MTP mode to see the options available in that setup. Set the result directory with --results-directory where supported. Do not copy VSTest’s --logger syntax into an MTP command without confirming the platform’s documentation.
Extension packages and switches can change. Confirm the current package and option names in Microsoft’s MTP test report extensions documentation and against the extensions registered by the project.
5. Choose and publish the right artifact
- Confirm the runner. Identify Console Runner, VSTest-based
dotnet test, or MTP. - Confirm the consumer. Use NUnit XML for a consumer expecting NUnit results, TRX for tooling that accepts Visual Studio test results, or HTML when a person needs a standalone view.
- Set the output directory and filename. Use a stable results directory in CI and unique names for separate target frameworks or parallel jobs.
- Publish the file produced by the command. Configure the CI artifact step to collect that exact path and extension. A successful test run does not automatically mean the artifact was uploaded.
- Inspect the artifact. Check that it exists, is non-empty, and represents the expected project and target framework before relying on it.
These choices matter because native XML, TRX, and HTML are different artifacts. A report viewer that expects TRX cannot be assumed to parse NUnit XML, and an HTML logger output is not interchangeable with either machine-readable result format.
6. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
nunit3-console is not found |
The Console Runner executable is not installed or is not on PATH. |
Install/use the runner configured for the project, or invoke it by its full path. For a project already using dotnet test, use that route’s logger instead. |
| No XML file appears | The command ran from a different working directory, or output was directed elsewhere. | Set --result and, for Console Runner, --work; then inspect that location. Check CI artifact paths too. |
| The result option is parsed incorrectly | The shell treated the semicolon in the result specification as a command separator. | Quote or escape the complete option value using the syntax for your shell. |
| HTML or TRX logger is unknown | The project may be using MTP, or the chosen logger is not available in that execution setup. | Confirm whether the command uses VSTest or MTP. For MTP, install/register the report extension and use its documented options. |
--report-trx is unrecognized |
The MTP TRX report extension may not be installed or registered. | Add and register the extension required by the project, then check the test app’s help output. |
| A multi-target run contains only one TRX file | The same specified filename was reused across target frameworks and later output may have overwritten earlier output. | Use a unique per-target naming strategy or the documented LogFilePrefix pattern. |
| CI says the report is missing although tests passed | The artifact collection pattern does not match the actual output directory or filename. | Set an explicit results directory and align the CI publish step with it. |
| NUnit XML is absent from a VSTest run | The VSTest logger produces its own artifact; adapter NUnit XML output is a separate setting. | Configure the NUnit3TestAdapter’s TestOutputXml setting for the installed adapter version if NUnit-native XML is required. |
7. Performance, reliability, and cost
Report generation is part of the test run, so its practical cost depends on the runner, test workload, and output format. The cited runner documentation does not establish a general report-generation benchmark, so measure it in your own pipeline if report time or storage is material. For reliable CI collection, choose explicit output locations, avoid filename collisions across frameworks or parallel jobs, and make artifact publication depend on the actual generated path. Keep machine-readable results when downstream tools need structured data; add a human-readable HTML artifact when people need to inspect failures.
The cited documentation does not provide a universal cost figure for NUnit report generation. Account for the CI minutes and artifact storage of your own provider and retention settings.
Or skip the browser setup
If you need a screenshot of a report page for a ticket, build log, or visual record, ScreenshotNeo can capture a URL with one API request. It is a website screenshot API and MCP server by Yorker Media; it does not replace NUnit’s XML, TRX, or HTML test-result generation. See the ScreenshotNeo API documentation for the request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up for 1,000 free screenshots a month, with no card.
FAQ
Does NUnit Console Runner generate an HTML report?
Its documented result output is NUnit XML. HTML is a separate presentation route, such as the VSTest HTML logger or an MTP HTML report extension.
Can one test run generate both NUnit XML and TRX?
They are separate outputs. The VSTest logger creates TRX, while NUnit3TestAdapter has separate settings for NUnit Test Result XML. Configure both only if your workflow needs both artifacts.
Which report should I keep in CI?
Keep the format your CI integration or downstream consumer requires. If people need a standalone view as well, configure an HTML report alongside the machine-readable artifact.
Where do I find the current MTP report switches?
Check the installed and registered report extensions and the test app’s help output; MTP switches depend on those extensions.


