简体   繁体   English

在VS2008中编写的TFS2010 Beta 2上的单元测试失败

[英]Unit tests failing on TFS2010 Beta 2 written in VS2008

I've just setup TFS 2010 Beta 2 on our server and it's running fine. 我刚刚在服务器上设置了TFS 2010 Beta 2,并且运行良好。 I've checked-in my solution which is written in Visual Studio 2008 SP1, with a main Class project and Unit test project. 我已经签入了用Visual Studio 2008 SP1编写的解决方案,其中包含一个主要的Class项目和Unit test项目。 Source control is working fine with the forward compatibility patch for VS 2008 Team explorer to work with TFS 2010. 源控制与VS 2008 Team Explorer的前向兼容性修补程序配合TFS 2010可以很好地工作。

The unit tests are written using MSTest. 单元测试使用MSTest编写。 It all works and runs locally with tests passing, but when I've setup the automated build on the server to build the solution, the main class project builds but the unit tests fail. 所有这些都可以通过测试并在本地运行并运行,但是当我在服务器上设置了自动构建以构建解决方案时,主类项目就构建了,但是单元测试失败了。

Client: Windows 7 64-bit, Visual Studio 2008 SP1 Server: Windows 2008 RS 64-bit, Team Foundation Server 2010 Beta 2 客户端:Windows 7 64位,Visual Studio 2008 SP1服务器:Windows 2008 RS 64位,Team Foundation Server 2010 Beta 2

I've tried different targets, different .net versions. 我尝试了不同的目标,不同的.net版本。 With the last attempt using the following MSTest version C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe I get the following error 在尝试使用以下MSTest版本C:\\ Program Files(x86)\\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ MSTest.exe时,出现以下错误

TFB210610: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '1'.

This leads me to think the tests are failing, but locally they are not. 这使我认为测试失败了,但是在本地却没有。

Has anyone else had any issues with this? 还有其他人对此有任何疑问吗? And can point me in the right direction? 可以指出正确的方向吗?

Cheers 干杯

Edit 编辑

I now get the following error ... 我现在收到以下错误...

C:\\Windows\\Microsoft.NET\\Framework64\\v3.5\\Microsoft.Common.targets: Could not resolve this reference. C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v3.5 \\ Microsoft.Common.targets:无法解析此引用。 Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 无法找到程序集“ Microsoft.VisualStudio.QualityTools.UnitTestFramework,版本= 9.0.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a,processorArchitecture = MSIL”。 Check to make sure the assembly exists on disk. 检查以确保程序集在磁盘上。 If this reference is required by your code, you may get compilation errors. 如果您的代码需要此引用,则可能会出现编译错误。

Run mstest.exe directly from a command line on the server like this: 像这样直接从服务器上的命令行运行mstest.exe

mstest.exe /testcontainer:myunittests.dll

That should give you some more information about what is going wrong. 那应该为您提供更多有关发生问题的信息。

Workaround 解决方法

I've managed to get it pretty much working. 我设法使它工作了很多。 It involved not using ExpectedException test attributes and registering a version 9 of the dll into the gac on the server. 它涉及不使用ExpectedException测试属性并将dll版本9注册到服务器上的gac。 This will do for now, hopefully it will be resolved in the full 2010 release, altho I will also be able to fully upgrade TFS and VS, so all will be good. 这将立即执行,希望它将在2010年完整版本中解决,而且我也将能够完全升级TFS和VS,因此一切都会很好。

A bit more detailed write up can be found here 可以在这里找到更详细的内容

:-) :-)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM