I’ve written some custom logic to get NUnit tests into a TFS build. It’s all working beautifully except when the tests don’t pass the build is partially succeeded rather than failed. Anyone know how I can tell it to fail?
Here’s what I’m trying:
<BuildStep Message="Integration Tests Passed"
Condition="$(TestsResult) == 'True'"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(IntegrationTestsStepId)"
Status="Succeeded" />
<BuildStep Message="Integration Tests FAILED"
Condition="$(TestsResult) != 'True'"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(IntegrationTestsStepId)"
Status="Failed"
CompilationStatus="Failed"
TestStatus="Failed"/>
<!-- If NUnit failed it's time to error out -->
<Error Condition="$(TestsResult) != 'True'" Text="Unit Tests Failed" />
It was the
<SetBuildProperties>that was the magic:I think it boils down to needing to signal the CompilationStatus and the TestStatus