在Team Foundation Server(TFS)构建上运行单元测试 [英] Running unit tests on Team Foundation Server (TFS) builds

查看:84
本文介绍了在Team Foundation Server(TFS)构建上运行单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行给定版本时,要使Team Foundation Server运行单元测试的步骤是什么?

What are the steps to get Team Foundation Server running unit tests when a given build runs?

在首次设置要执行此操作的TFS服务器时,开发人员或sysadmin应注意的警告/陷阱/解决方法是什么?

What are the caveats / pitfalls / workarounds a dev or sysadmin should be aware of when setting up a TFS server to do this for the first time?

针对构建期间的单元测试问题,常见的故障排除步骤是什么?

What are common troubleshooting steps for unit test problems during builds?

推荐答案

这取决于您运行的TFS版本,所以我假设它是2008年.

it depends on which version of TFS you are running, so I will assume it is 2008.

首先,如有几种方法可以告诉Team Build为您的构建运行测试.

There are a couple of ways to tell Team Build to run tests for your build.

    可以从正在构建的解决方案中的已定义测试列表中运行
  1. 单元测试.该列表由构建定义引用,并执行所选列表中的所有测试.详细信息此处
  2. 通过定义通配符掩码(即Test * .dll),也可以通过
  3. WildCard测试执行来指示Team Build运行与该掩码匹配的程序集中存在的任何测试.在定义构建定义时也会完成此操作.
  1. Unit tests can be run from a defined Test List within the Solution being built. This list is referenced by the build definition and all tests within the chosen list(s) are executed. More info here
  2. WildCard test exectution is also available by defining a wildcard mask (i.e. Test*.dll) that instructs Team Build to run any tests present in assemblies that match the mask. This is done when defining the build definition as well.

注意事项:

如果您打算使用通配符方法并希望对测试配置启用代码覆盖,则必须将以下内容添加到构建定义文件中以启用它.

If you intend to use the wildcard method and want to enable code coverage for your test configuration, you must add the following to your build definition file to enable it.

<RunConfigFile>$(SolutionRoot)\TestRunConfig.testrunconfig</RunConfigFile>

有关更多信息,请参见我之前的问题

See my previous question on this for more info here

这篇关于在Team Foundation Server(TFS)构建上运行单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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