AgileTestware

NUnit Integration

Report NUnit test results to HP ALM via Bumblebee.

Overview

NUnit generates XML test reports that Bumblebee processes and publishes to HP ALM. Both NUnit 2 and NUnit 3 report formats are supported.

Generating NUnit Reports

.NET CLI (NUnit 3)

dotnet test --logger "nunit;LogFilePath=TestResults/nunit-results.xml"

NUnit Console Runner

nunit3-console.exe MyTests.dll --result=TestResults\nunit-results.xml

MSBuild / Visual Studio

Add the NUnit3TestAdapter package to your test project:

<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />

Run with:

dotnet test --logger trx

Or configure a custom NUnit result file logger in your .runsettings:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <NUnit>
    <OutputXmlFilename>TestResults/nunit-results.xml</OutputXmlFilename>
  </NUnit>
</RunSettings>

Jenkins Pipeline

pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        bat 'dotnet test --logger "nunit;LogFilePath=TestResults/nunit-results.xml"'
      }
    }
  }
  post {
    always {
      bumblebeeALMPublisher(
        almServerUrl: 'https://alm.example.com/qcbin',
        almDomain: 'DEFAULT',
        almProject: 'MyProject',
        testResultsPattern: 'TestResults/nunit-results.xml',
        testSetFolder: "Root\\CI\\${env.JOB_NAME}"
      )
    }
  }
}

NUnit 2 vs NUnit 3

Bumblebee automatically detects the NUnit report format version. No additional configuration is needed.

FeatureNUnit 2NUnit 3
Report format<test-results> root<test-run> root
Nested suitesSupportedSupported
AttachmentsNot supportedSupported
CategoriesSupportedSupported

ALM Test Case Naming

NUnit test cases are mapped to ALM using:

  • Test Plan path: Subject\<namespace>.<className>
  • Test case name: <methodName>

Configure classNameMapping in alm-mappings.xml to strip namespace prefixes if desired.

On this page