在 TFS 2008 上运行自动化测试

发布于 2024-07-15 17:11:35 字数 227 浏览 5 评论 0原文

我们已将 TFS 设置为在签入时自动构建,效果很好。

我们的问题是如何让单元测试在服务器上运行?

  1. 我们如何在构建服务器上运行测试?
  2. 我们如何在服务器上自动运行SQL脚本来构建测试数据库?
  3. 我们需要在构建服务器上安装 Visual Studio 吗?
  4. 我们在客户端上需要 Visual Studio 测试版吗?

We have set TFS up to automatically build when we check-in, that works fine.

Our problem is how do we get the unit tests to run on the server?

  1. How do we run tests on the build server?
  2. How do we automatically run SQL Scripts on the server to build the test database?
  3. Do we need to install Visual Studio on the Build Server?
  4. Do we need Visual Studio Test Edition on the client?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉世弥音 2024-07-22 17:11:35

打开 TeamBuildType 文件 (TFSBuild.proj)。
在那里你会看到像下面这样的评论......

<!--  TEST ARGUMENTS
 If the RunTest property is set to true then the following test arguments will be used to run 
 tests. Tests can be run by specifying one or more test lists and/or one or more test containers.

 To run tests using test lists, add MetaDataFile items and associated TestLists here.  Paths can 
 be server paths or local paths, but server paths relative to the location of this file are highly 
 recommended:

    <MetaDataFile Include="$(BuildProjectFolderPath)/HelloWorld/HelloWorld.vsmdi">
        <TestList>BVT1;BVT2</TestList>
    </MetaDataFile>

 To run tests using test containers, add TestContainer items here:

    <TestContainer Include="$(OutDir)\HelloWorldTests.dll" />
    <TestContainer Include="$(SolutionRoot)\TestProject\WebTest1.webtest" />
    <TestContainer Include="$(SolutionRoot)\TestProject\LoadTest1.loadtest" />

 Use %2a instead of * and %3f instead of ? to prevent expansion before test assemblies are built
-->

Open your TeamBuildType File (TFSBuild.proj).
In there you'll see a comment like the one below...

<!--  TEST ARGUMENTS
 If the RunTest property is set to true then the following test arguments will be used to run 
 tests. Tests can be run by specifying one or more test lists and/or one or more test containers.

 To run tests using test lists, add MetaDataFile items and associated TestLists here.  Paths can 
 be server paths or local paths, but server paths relative to the location of this file are highly 
 recommended:

    <MetaDataFile Include="$(BuildProjectFolderPath)/HelloWorld/HelloWorld.vsmdi">
        <TestList>BVT1;BVT2</TestList>
    </MetaDataFile>

 To run tests using test containers, add TestContainer items here:

    <TestContainer Include="$(OutDir)\HelloWorldTests.dll" />
    <TestContainer Include="$(SolutionRoot)\TestProject\WebTest1.webtest" />
    <TestContainer Include="$(SolutionRoot)\TestProject\LoadTest1.loadtest" />

 Use %2a instead of * and %3f instead of ? to prevent expansion before test assemblies are built
-->
转身以后 2024-07-22 17:11:35

如果要运行 NUnit-Tests,则必须设置一个包含在 Build-.proj 文件中的 MSBuild-Task。 如果您想运行 VS 集成测试,默认构建脚本中有预配置的任务。 示例(已注释掉)在生成的 Build-.proj-文件中。

通常,您可以在构建中运行您想要的任何内容。 只需创建 MSBuild 任务并将其集成到现有的构建脚本中即可,该脚本已经可以在多个位置进行扩展。 在这里描述 MSBuild 的全部内容太多,无法回答。 请参阅有关 MSBuild 的各种 Web 资源。

您需要安装在构建机上运行测试所需的一切。 用于 NUnit 测试的 NUnit、用于负载测试和 Web 测试的 VS Test 版本等等。

构建服务器对您在任何客户端上安装的内容都不感兴趣。

If you want to run NUnit-Tests, you have to setup a MSBuild-Task which you include in your Build-.proj File. If you want to run the VS-Integrated Tests there are preconfigured tasks in the default Build-Script. Samples are (commented out) in your generated Build-.proj-File.

You can generally run whatever you want in your build. It's just a matter of creating the MSBuild-Tasks and integrating them into the existing build-script, which is already extensible in several locations. Describing all of MSBuild is too much to answer here. Please refer to the various Web-Sources about MSBuild.

You need to install whatever is necessary to run the tests on the Build-Machine. NUnit for NUnit-Tests, VS Test Edition for Loadtests and Webtests, and so on.

What you install on any client is of no interest for the Build-Server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文