简体   繁体   English

使用TFS 2008将单元测试作为CI的一部分运行时,MsTest失败

[英]MsTest fails when running unit tests as part of CI using TFS 2008

My configuration: 我的配置:

  • VS2010 solution VS2010解决方案
  • TFS 2008 TFS 2008
  • Build server - TFS 2008 构建服务器 - TFS 2008
    • Build server also has VS2008 Team Suite and VS2010 ultimate installed 构建服务器还安装了VS2008 Team Suite和VS2010

TFS 2008 builds my VS2010 solution properly. TFS 2008正确构建我的VS2010解决方案。 But when it comes time to run the unit tests I get the following MsTest error. 但是,当运行单元测试时,我得到以下MsTest错误。

Using "TestToolsTask" task from assembly "D:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\PrivateAssemblies\\Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll". 使用程序集“D:\\ Program Files \\ Microsoft Visual Studio 9.0 \\ Common7 \\ IDE \\ PrivateAssemblies \\ Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll”中的“TestToolsTask”任务。 Task " TestToolsTask " Command: 任务“ TestToolsTask ”命令:
d:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe /nologo /searchpathroot:"D:\\Builds\\App\\Source\\86\\Binaries" /resultsfileroot:"D:\\Builds\\App\\Source\\86\\TestResults" /testcontainer:"D:\\Builds\\App\\Source\\86\\Binaries\\\\Tests.dll" /publish:"http://tfsServer:8080/" /publishbuild:"vstfs:///Build/Build/26029" /teamproject:"Proposal" The "TestToolsTask" task is using "MSTest.exe" from "d:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe". d:\\ Program Files \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ MSTest.exe / nologo / searchpathroot:“D:\\ Builds \\ App \\ Source \\ 86 \\ Binaries”/ resultsfileroot:“D:\\ Builds \\ App \\ Source \\ 86 \\ TestResults“/ testcontainer:"D:\\Builds\\App\\Source\\86\\BINaries\\\\Tests.dll”/ publish:“http:// tfsServer:8080 /”/ publishbuild:“vstfs:/// Build / Build / 26029“/ teamproject:”Proposal“ TestToolsTask”任务使用“d:\\ Program Files \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ MSTest.exe”中的“MSTest.exe”。 No platform specified for publish operation. 没有为发布操作指定平台。 For switch syntax, type "MSTest /help" MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1. [D:\\Builds\\App\\Source\\86\\BuildType\\TFSBuild.proj] The previous error was converted to a warning because the task was called with ContinueOnError=true. 对于切换语法,键入“MSTest / help” MSBUILD:警告MSB6006:“MSTest.exe”退出,代码为1. [D:\\ Builds \\ App \\ Source \\ 86 \\ BuildType \\ TFSBuild.proj]上一个错误已转换为警告,因为使用ContinueOnError = true调用任务。 Build continuing because "ContinueOnError" on the task "TestToolsTask" is set to "true". 构建继续,因为任务“TestToolsTask”上的“ContinueOnError”设置为“true”。 Done executing task "TestToolsTask" -- FAILED. 完成执行任务“TestToolsTask” - 失败。

I am not sure what is causing MsTest to fail. 我不确定导致MsTest失败的原因。

Things tried: - Provided write access to the build folder to the service account that builds the source on the build machine 尝试的事情: - 提供对构建文件夹的写访问权限,以便在构建计算机上构建源代码的服务帐户

You can execute a VS2010 build from within TFS2008's MSBuild, but it looks as if it's using Visual Studio 9.0 TestToolsTask (2008) to try to run a Visual Studio 10.0 (2010) test project (MSTest.exe). 您可以在TFS2008的MSBuild中执行VS2010构建,但看起来它使用Visual Studio 9.0 TestToolsTask(2008)来尝试运行Visual Studio 10.0(2010)测试项目(MSTest.exe)。 I'd try tweaking MSBuild to run the TestToolsTask from the "Microsoft Visual Studio 10.0" folder rather than "9.0", so that the entire process is using the same version of the tools. 我尝试调整MSBuild从“Microsoft Visual Studio 10.0”文件夹而不是“9.0”运行TestToolsTask,以便整个过程使用相同版本的工具。 You can override the tools paths in your tfsbuild.proj file's Properties to ensure the correct version of Visual Studio is used to build with - something similar may apply to the test tools. 您可以覆盖tfsbuild.proj文件的属性中的工具路径,以确保使用正确版本的Visual Studio构建 - 类似的东西可能适用于测试工具。

Alternatively, it's running the VS2010 test tools correctly, but still trying to use a command line that is specific to 2008 - check the settings and see if you can tweak the command line (you may need to override the MS targets files that is running the build if it's a 2008 version). 或者,它正在运行VS2010测试工具,但仍尝试使用特定于2008的命令行 - 检查设置并查看是否可以调整命令行(您可能需要覆盖运行该命令行的MS目标文件)如果它是2008版本,则构建)。 For example in TFS 2010, a lot of command lines changed from using a simple "server:MyServer" to something like "collection:http://MyServer:8080/tfs/MyCollection". 例如,在TFS 2010中,许多命令行从使用简单的“服务器:MyServer”变为类似“集合:http:// MyServer:8080 / tfs / MyCollection”。 You may therefore have to alter the command line to gain full compatibility with the 2010 version of the tool that is now running, even if it still ultimately points at a 2008 server. 因此,您可能必须更改命令行才能与现在运行的2010版本工具完全兼容,即使它最终仍然指向2008服务器。

My third suggestion (which isn't necessarily very helpful) is to just upgrade to TFS2010 - it's typically a painless install, vastly better than 2008, and will eliminate any difficulties caused by using a hybrid 2008/2010 setup. 我的第三个建议(不一定非常有帮助)是升级到TFS2010 - 它通常是一个无痛的安装,比2008年好得多,并且将消除使用混合2008/2010设置造成的任何困难。 (If it helps, I was reluctant to upgrade to 2010 because the 2005->2008 upgrade was 8 days of sheer hell. But in comparison the core of the upgrade to 2010 only took a few hours and "just worked" - the install/upgrade process is much improved) (如果它有所帮助,我不愿意升级到2010年,因为2005-> 2008升级仅仅是8天的纯粹地狱。但相比之下,升级到2010年的核心只用了几个小时而且“刚刚工作” - 安装/升级过程大大改进)

Jason had the correct idea that lead me down to the correct solution. 杰森有正确的想法,引导我找到正确的解决方案。

In my case, I had to update the "Microsoft.TeamFoundation.Build.targets" to point to "Microsoft.TeamFoundation.Build.ProcessComponents.dll" (VS2010 dll) instead of "Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll" (VS2008 dll) 在我的情况下,我不得不更新“Microsoft.TeamFoundation.Build.targets”以指向“Microsoft.TeamFoundation.Build.ProcessComponents.dll”(VS2010 dll)而不是“Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll”( VS2008 dll)

I also had to make sure that the PlatformToBuild was specified in the TfsBuild.proj file. 我还必须确保在TfsBuild.proj文件中指定了PlatformToBuild。

Once these 2 steps were done, UnitTests were being run as part of the CI build using TFS2008 and a VS2010 solution. 完成这两个步骤后,使用TFS2008和VS2010解决方案将UnitTests作为CI构建的一部分运行。

I have blogged about the solution in detail here: http://blog.aggregatedintelligence.com/2011/03/vs2010-tfs-2008-and-unit-tests.html 我在这里详细介绍了解决方案: http//blog.aggregatedintelligence.com/2011/03/vs2010-tfs-2008-and-unit-tests.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从VS2008内部运行单元测试与在命令行上使用mstest - Running unit tests from within VS2008 vs using mstest on the command line 需要在项目上运行项目时运行MSTest单元测试 - Run MSTest unit tests on a project when it needs to be running 如何在Visual Studio 2008中配置MsTest的单元测试? - How to Profile Unit Tests of MsTest in Visual Studio 2008? 自从VS在TFS2012上升级到2013后,在自动构建中运行单元测试时出错 - Error when running unit tests in automated build since VS upgrade to 2013 on TFS2012 如何并行运行单元测试(MSTest)? - How to run unit tests (MSTest) in parallel? 在Visual Studio中运行单元测试时出现FileLoadException - FileLoadException when running unit tests in visual studio 在 C++ 中以 64 位运行 mstest 测试 - Running mstest tests in c++ in 64 bits TFS2015作为单元测试运行SoapUI测试-错误:无法创建Java虚拟机 - TFS2015 running SoapUI test as unit tests - Error: Could not create the Java Virtual Machine 在与名称模式匹配的项目中使用mstest运行所有单元测试 - Run all unit tests with mstest in projects matching a name pattern Azure Devops - MSTest - 如果我的单元测试失败,我如何使构建失败,但在集成测试失败时继续(带有警告/通知) - Azure Devops - MSTest - How can I fail a build if my unit tests fail, but continue (with warning/notification) when integration test fail
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM