本文介绍了如何获得Team Build来运行MbUnit测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法让Team Build执行我的MbUnit单元测试.我尝试编辑TFSBuild.proj并添加了以下部分:
I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:
<Project ...>
<UsingTask TaskName="MbUnit.MSBuild.Tasks.MbUnit" AssemblyFile="path_to_MbUnit.MSBuild.Tasks.dll" />
...
...
<ItemGroup>
<TestAssemblies Include="$(OutDir)\Project1.dll" />
<TestAssemblies Include="$(OutDir)\Project2.dll" />
</ItemGroup>
<Target Name="Tests">
<MbUnit
Assemblies="@(TestAssemblies)"
ReportTypes="html"
ReportFileNameFormat="buildreport{0}{1}"
ReportOutputDirectory="." />
</Target>
...
</Project>
但是我还没有运行测试.
But I have yet to get the tests to run.
推荐答案
以上建议对我没有多大帮助,但我找到了一些有关Team Build的文档,并调整了我的构建脚本以覆盖AfterCompile目标:
Above suggestion didn't help me a lot, but I found some documentation for Team Build and adjusted my build script to override the AfterCompile target:
(现在,我对团队建设有了更好的了解,我在测试运行器中添加了更多内容.它现在将使用带有测试运行细节的构建步骤来更新Build Explorer/Build监视器.)
<Project ...>
<UsingTask TaskName="MbUnit.MSBuild.Tasks.MbUnit" AssemblyFile="path_to_MbUnit.MSBuild.Tasks.dll" />
...
...
<Target Name="AfterCompile">
<ItemGroup>
<TestAssemblies Include="$(OutDir)\Project1.dll" />
<TestAssemblies Include="$(OutDir)\Project2.dll" />
</ItemGroup>
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Message="Running tests (cross your fingers)...">
<Output TaskParameter="Id" PropertyName="StepId" />
</BuildStep>
<MbUnit
Assemblies="@(TestAssemblies)"
ReportTypes="html"
ReportFileNameFormat="buildreport{0}{1}"
ReportOutputDirectory="." />
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(StepId)"
Message="Yay! All tests succeded!"
Status="Succeeded" />
<OnError ExecuteTargets="MarkBuildStepAsFailed" />
</Target>
<Target Name="MarkBuildStepAsFailed">
<BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(StepId)"
Message="Oh no! Some tests have failed. See test report in drop folder for details."
Status="Failed" />
</Target>
...
</Project>
这篇关于如何获得Team Build来运行MbUnit测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!