在 Team Foundation Server (TFS) 版本上运行单元测试
当给定的构建运行时,让 Team Foundation Server 运行单元测试的步骤是什么?
首次设置 TFS 服务器以执行此操作时,开发人员或系统管理员应注意哪些警告/陷阱/解决方法?
构建期间单元测试问题的常见故障排除步骤有哪些?
What are the steps to get Team Foundation Server running unit tests when a given build runs?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您运行的 TFS 版本,因此我假设它是 2008 年。
首先,您必须在计算机上安装 Team Edition for Testers,它将充当您的构建代理,如 如何:创建构建定义
有几种方法可以告诉 Team Build 运行测试你的构建。
注意事项:
如果您打算使用通配符方法并希望为测试配置启用代码覆盖率,则必须将以下内容添加到构建定义文件中以启用它。
请参阅我之前的问题以获取更多信息此处
it depends on which version of TFS you are running, so I will assume it is 2008.
Firstly, you must have Team Edition for Testers installed on the computer that will act as your build agent, as stated in How To: Create a Build Definition
There are a couple of ways to tell Team Build to run tests for your build.
Things to note:
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.
See my previous question on this for more info here
如果您不想使用测试配置(管理起来很麻烦),只需将其添加到构建配置中即可在 .dll 中运行所有测试:
整个过程非常顺利且相当简单。 您可以通过在本地打开测试结果文件来检查构建服务器上的单元测试(有点痛苦),但通常您只需在本地运行单元测试,就可以立即看到结果。
如果您习惯使用 NUnit,您可以选择按类名对测试进行排序,它提供了类似的视图。
小心代码覆盖率,它会在编译时生成二进制文件的完整副本。 如果您的二进制文件足够大并且经常编译,它将很快耗尽驱动器空间。
If you don't want to use test configs (A Pain in the ass to manage) just run all the test in a .dll by adding this to the build config:
The whole process is smooth and fairly simple. You can inspect the unit tests that filaed on the build server by opening the test result file locally (a bit of a pain) but generally you'll just run the unit tests locally and you can see the results immediately.
If you are used to NUnit, you may opt to sort the tests by classname, it gives a similar view.
Careful with code coverage, it makes complete copies of your binaries on compile. If your binaries are sufficiently large and you compile often, it will eat through drive space quickly.
http://msdn.microsoft.com/en -us/library/cc981972(v=vs.90).aspx
我喜欢这个定义,因为它为您提供了完整的“演练”
创建项目
创建单元测试项目
配置团队构建以使用它单元测试
http://msdn.microsoft.com/en-us/library/cc981972(v=vs.90).aspx
I like this defination as it gives you a complete 'walkthrough' from
Creating the Project
Creating the Unit Test Project
To configuring Team build to use it Unit Test