@testream/dotnet-reporter
v0.4.0
Published
CLI to upload .NET test results (xUnit, NUnit, MSTest) to Testream
Maintainers
Readme
@testream/dotnet-reporter
Run .NET tests and upload results to Testream with a single command.
Features
- Zero Configuration - Just run and upload, no TRX path needed
- All .NET Frameworks - Works with xUnit, NUnit, and MSTest
- Auto-Detection - Detects test framework and git context automatically
- CI/CD Ready - Works in GitHub Actions, GitLab CI, Azure Pipelines, and more
Quick Start
# One command does everything!
npx @testream/dotnet-reporter -p MYPROJ -k your-api-keyThat's it! The CLI will:
- Run
dotnet test - Generate a test report
- Upload to Testream
Installation
# Use directly with npx (recommended)
npx @testream/dotnet-reporter ...
# Or install globally
npm install -g @testream/dotnet-reporter
testream-dotnet ...Usage
Basic Usage
# Run tests in current directory and upload
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY
# Run tests for a specific project
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY --project ./MyTests
# Run tests for a solution
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY --project ./MySolution.slnPass Arguments to dotnet test
# Filter tests
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY -- --filter "Category=Unit"
# Set configuration
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY -- --configuration Release
# Multiple arguments
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY -- --filter "Category=Unit" --no-buildUse Existing TRX File
If you've already run tests and have TRX file(s):
npx @testream/dotnet-reporter -p MYPROJ -k $API_KEY --trx-path TestResults/*.trxCLI Options
| Option | Description |
|--------|-------------|
| -p, --project-key | (Required) Jira project key |
| -k, --api-key | (Required) API key for authentication |
| --project <path> | Path to .NET project/solution (defaults to current directory) |
| --trx-path <path> | Use existing TRX file(s) instead of running tests |
| --test-tool | Test framework name (auto-detected) |
| --branch | Git branch (auto-detected in CI) |
| --commit-sha | Git commit SHA (auto-detected in CI) |
| -- <args> | Additional arguments to pass to dotnet test |
GitHub Actions Example
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Run tests and upload
run: |
npx @testream/dotnet-reporter \
-p ${{ secrets.PROJECT_KEY }} \
-k ${{ secrets.API_KEY }} \
--project ./MySolution.sln \
--test-tool xunit \
--branch ${{ github.ref_name }} \
--commit-sha ${{ github.sha }} \
--repository-url ${{ github.server_url }}/${{ github.repository }} \
--build-name ${{ github.workflow }} \
--build-number ${{ github.run_number }} \
--build-url ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
--test-environment ci \
--app-name MyApp \
--app-version 1.0.0 \
--test-type unit \
--fail-on-error \
-- --configuration ReleaseHow It Works
┌──────────────────────────────────────────┐
│ @testream/dotnet-reporter │
├──────────────────────────────────────────┤
│ 1. Run dotnet test │
│ 2. Generate report │
│ 3. Upload to Testream │
└──────────────────────────────────────────┘It all happens automatically - just provide your project key and API key!
Supported Frameworks
| Framework | Version | Status | |-----------|---------|--------| | xUnit | 2.x+ | ✅ Tested | | NUnit | 4.x+ | ✅ Tested | | MSTest | 3.x+ | ✅ Tested |
Supported CI Platforms
Git context (branch, commit, repository) is auto-detected in:
- GitHub Actions
- GitLab CI
- Azure Pipelines
- CircleCI
- Jenkins
- Bitbucket Pipelines
License
See LICENSE file.
