Skip to content

Add xUnit test project and wire dotnet test into CI #41

Description

@velocitysystems

Background

PR #39 removed Raygun4Maui.Test/, which was an orphaned MAUI sample project (XAML/Shell, namespace Raygun4Maui.testtest) that wrapped three trivial xUnit [Fact] smoke tests in RaygunClientTest.cs. The project was never built or test-run by CI (the workflow only dotnet builds the shipping libraries), and nothing else in the solution referenced it. Removing it was correct, but it leaves the repo with zero automated tests.

This issue tracks restoring real test coverage with infrastructure that's actually wired into CI.

Goal

Add a proper test project and a dotnet test step to the CI pipeline so changes to the shipping libraries are validated automatically.

Proposed shape

  • New Raygun4Maui.Tests/ project:
    • Plain net10.0 TFM (no MAUI workload, no Android/iOS multi-targeting) so tests run on any host without simulator/emulator/Xcode requirements.
    • xUnit (consistent with the prior project's intent) plus Microsoft.NET.Test.Sdk and xunit.runner.visualstudio.
    • <IsPackable>false</IsPackable>, <ProjectReference> to Raygun4Maui (and Raygun4Maui.Platform if needed for shared types).
  • Reinstate the original three smoke tests as a starting point:
    • RaygunMauiClient.Send produces a RaygunMessage with non-null Details.
    • Details.Environment is populated.
    • Details.Client is populated.
  • Add coverage for higher-value paths the old project never tested:
    • Offline-storage queueing + flush behaviour.
    • RUM event construction (page-load, network-call, app-launch span shapes).
    • RaygunMauiUserProvider flow (SetUser → message contains identifier).
    • IgnoredViews / IgnoredUrls filtering from Raygun4MauiSettings.
    • RaygunBreadcrumbs.Record round-trip.
  • Add Raygun4Maui.Tests to Raygun.MAUI.sln.

CI changes

In .github/workflows/ci.yml, after the existing Build Raygun4Maui step, add:

- name: Run unit tests
  run: dotnet test Raygun4Maui.Tests/Raygun4Maui.Tests.csproj -c Release --no-build --logger "trx;LogFileName=test-results.trx"

- name: Upload test results
  if: always()
  uses: actions/upload-artifact@v5
  with:
    name: test-results
    path: "**/test-results.trx"

The job already runs windows-latest with the .NET 10 SDK installed, so no additional setup is needed for the plain net10.0 TFM.

Out of scope (for this issue)

  • MAUI-typed integration tests that need an Android emulator or iOS simulator. Those belong in a separate effort using something like xunit-maui-runner or Appium, and the smoke testing the SampleApp already does via the simulator/emulator flow covers a lot of that ground manually for now.
  • Pinning a specific code-coverage threshold — propose adding that later once a baseline exists.

Benefits

  • Restores the testing posture lost when Raygun4Maui.Test/ was removed.
  • Catches regressions on the platform-agnostic code paths automatically, on every PR.
  • Cheap to set up (~one afternoon) and runs on the existing CI runners with no extra workloads.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions