Configure your build server
On the build server, just NuGet the runner:
nuget.exe xunit.runner.consoleThe Bamboo cannot parse xUnit output. It can handle the nUnit output nd the xUnit has an option to print results in the nUnit format. So, create a simple
xunit.cmd
script:
@echo off @rem xunit runner for Bamboo if "%2"=="" ( echo Usage: test.dll report.xml exit /b 1 ) if not exist %~dp2 mkdir %~dp2 "c:\path\to\xunit.runner.console.2.1.0\tools\xunit.console.exe" %1 -nunit %2
Configure Bamboo
Then go to your Bamboo Administration - Agents Summary and choose your agent. Add a new capability:
Capability type | Executable |
Executable label | xUnit |
Path | c:\path\to\xunit.cmd |
To add the xUnit to you plan's job, just add the Command task after the project build (e.g. MSBuild, or NAnt). I expect you have a module MyProjectTests in your solution. Then configure the xUnit task:
Executable | xUnit |
Argument | bin\Release\MyProjectTests.dll test-reports\MyProjectTests.xml |
Working sub directory | MyProjectTests |
The final trick is to add the NUnit Parser task, just take care to put is as the final task:
NUnit Test Results File/Directory | MyProjectTests/test-reports/*.xml |
The bamboo logic is, that:
- Any task fails, and no test result is found, it assumes the compilation error has occurred.
- Any task fails, and a test result is found, it assumes a test has failed.
- All tasks pass, the build is OK. If the test results are found, they are picked up.
Žádné komentáře:
Okomentovat