如何获得单元测试作为TFS2008构建的一部分运行? [英] How can I get unit tests to run as part of a TFS2008 build?

查看:229
本文介绍了如何获得单元测试作为TFS2008构建的一部分运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的连续集成设置为我运行我的单元测试,所以我设置了

  < RunTest> true< / RunTest> 

我已设置测试以自动发现:

 < ItemGroup> 
< TestContainer Include =$(OutDir)%2a.Test.dll/>
< / ItemGroup>

在我的开发机器上运行构建运行我的单元测试,并报告构建成功;当作为自动构建运行时,测试运行(根据BuildLog),但我在日志中看到:


测试运行结果tfs_service @ TFS-BUILD 2012-04-13 14:13:59_Any CPU_Release到 http:// mycompany-tfs:8080 / Build / v1.0 / PublishTestResultsBuildService2.asmx ...



< \\ tfs-build \Builds\Test\MyProduct Test_20120413.2无法访问。



删除共享目录\tfs-build\Builds \Test\MyProduct Test_20120413.2无法访问。



MSBUILD:警告MSB6006:MSTest.exe以代码1退出。



上一个错误已转换为警告,因为任务使用ContinueOnError = true调用。


这是奇怪的,因为二进制发布相当愉快。



我试图诊断问题,通过登录构建服务器的控制台,运行一个Visual Studio 2008命令提示符,导航到源位置,并调用MSBuild,它似乎甚至不尝试调用单元测试?



最终,我更感兴趣在玩猜测为什么结果失败 - 它可以是我的构建定义名称中的嵌入式空间吗?还有什么可以检查,给定二进制发布OK?

解决方案

单元测试正在运行,问题是,未正确发布。运行单元测试时,结果将发布到tfs服务器,然后复制到放置位置。因此,下载共享需要允许TFS构建服务帐户写入此文件夹。



http://blogs.msdn.com/b/vstsqualitytools/archive /2010/10/24/test-agent-test-controller-and-mstest-faq.aspx


I'm trying to get my continuous integration setup to run my unit tests for me, so I've set

<RunTest>true</RunTest>

And I've setup the tests to auto-discover:

<ItemGroup>
  <TestContainer Include="$(OutDir)%2a.Test.dll" />
</ItemGroup>

Running the build on my development machine runs my unit tests, and reports that the Build succeeded; When run as an automated build, the tests run (according to the BuildLog), but I'm seeing this in the log:

Publishing results of test run tfs_service@TFS-BUILD 2012-04-13 14:13:59_Any CPU_Release to http://mycompany-tfs:8080/Build/v1.0/PublishTestResultsBuildService2.asmx...

.The drop share directory "\tfs-build\Builds\Test\MyProduct Test_20120413.2" could not be accessed.

The drop share directory "\tfs-build\Builds\Test\MyProduct Test_20120413.2" could not be accessed.

MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.

The previous error was converted to a warning because the task was called with ContinueOnError=true.

This is odd, as the binaries publish quite merrily.

I tried to diagnose the issue, by logging on to the console of the build server, running up a Visual Studio 2008 Command Prompt, navigating to the source location, and invoking MSBuild, it doesn't appear to even attempt to invoke the unit tests?

Ultimately, I'm more interested in playing "guess why the drop of the results failed" - could it be the embedded space in my build definition name? What else could I check, given the binaries publish OK?

解决方案

The unit tests are running, the problem is that the results are not being published correctly. When unit tests are run, the results are published to the tfs server and then copied to the drop location. Because of this, the drop share needs to allow the TFS build service account to write to this folder.

http://blogs.msdn.com/b/vstsqualitytools/archive/2010/10/24/test-agent-test-controller-and-mstest-faq.aspx

这篇关于如何获得单元测试作为TFS2008构建的一部分运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆