简体   繁体   English

TFS 2010 中的多个构建配置不运行单元测试

[英]Unit tests aren't run with multiple build configurations in TFS 2010

I am using MSBuild in my TFS Buildprocess using the DefaultTemplate to build multiple configurations(Debug/Release) of the same solution.我在我的 TFS 构建过程中使用 MSBuild 使用 DefaultTemplate 构建同一解决方案的多个配置(调试/发布)。 When I build only release or only debug the unit tests are run but when I run the build with both configurations the unit tests are not run.当我仅构建发布或仅调试时,会运行单元测试,但是当我使用两种配置运行构建时,单元测试不会运行。

When I am running multiple configurations I have each of them Defined in the build definition under Process-> Items to Build-> Configurations to Build which is Mixed Platforms|Release,Mixed Platforms|Debug.当我运行多个配置时,我将它们中的每一个都定义在 Process-> Items to Build-> Configurations to Build 下的构建定义中,即 Mixed Platforms|Release,Mixed Platforms|Debug。 When I run a single configuration I am using Mixed Platforms|Release or Mixed Platforms|Debug.当我运行单个配置时,我使用的是混合平台|发布或混合平台|调试。

I am unable to put the entire log here(It is over 6000 lines long) but it appears that it isnt finding any of the testAssemblies.我无法将整个日志放在这里(超过 6000 行),但它似乎没有找到任何 testAssemblies。

Edit:编辑:

Here are the actual sections of the log.以下是日志的实际部分。 I'm not sure where Mixed Platforms\Release is coming from in the searchpathroot.我不确定搜索路径根中 Mixed Platforms\Release 的来源。

I should also add that we compile into our Source's folder because a few of our scripts only work in that layout.我还应该补充一点,我们编译到我们的源文件夹中,因为我们的一些脚本只在那个布局中工作。

Debug Only(works)仅调试(有效)

Run MSTest for Test Assemblies C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\ProductName\BuildName\Sources\Product\Local.testsettings" /searchpathroot:"C:\Builds\6\ProductName\BuildName\Sources" /resultsfileroot:"C:\Builds\6\ProductName\BuildName\TestResults" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Debug\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Debug\UnitTestWCF.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Release\UnitTestWCF.dll" /publish:"http://dctfs2010.company.dc:8080/tfs/Product" /publishbuild:"vstfs:///Build/Build/964" /teamproject:"ProductName" /platform:"Mixed Platforms" /flavor:"Debug" Loading Z0D61F8370CAD1D412F80B84D143E125为测试程序集运行 MSTest C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\ProductName\BuildName\Sources\Product\Local .testsettings" /searchpathroot:"C:\Builds\6\ProductName\BuildName\Sources" /resultsfileroot:"C:\Builds\6\ProductName\BuildName\TestResults" /testcontainer:"C:\Builds\6\ProductName\ BuildName\Sources\Test\UnitTestCommon\bin\Debug\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll" /testcontainer:"C :\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Debug\UnitTestWCF.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Release\UnitTestWCF .dll" /publish:"http://dctfs2010.company.dc:8080/tfs/Product" /publishbuild:"vstfs:///Build/Build/964" /teamproject:"ProductName" /platform:"混合平台" /flavor:"调试" 加载 Z0D61F8370CAD1D412F80B84D143E125 7Z:\Builds\6\ProductName\BuildName\Sources\Product\Local.testsettings... Loading C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Debug\UnitTestCommon.dll... Loading C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll... 7Z:\Builds\6\ProductName\BuildName\Sources\Product\Local.testsettings... 加载中C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll...

Debug and Release(Does not work)调试和发布(不起作用)

Run MSTest for Test Assemblies C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\ProductName\BuildName\Sources\Product\Local.testsettings" /searchpathroot:"C:\Builds\6\ProductName\BuildName\Sources\Mixed Platforms\Release" /resultsfileroot:"C:\Builds\6\ProductName\BuildName\TestResults" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Debug\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Debug\UnitTestWCF.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Release\UnitTestWCF.dll" /publish:"http://dctfs2010.company.dc:8080/tfs/Product" /publishbuild:"vstfs:///Build/Build/962" /teamproject:"ProductName" /platform:"Mixed Platforms" /flavor:"Release" Directory "C:\为测试程序集运行 MSTest C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\ProductName\BuildName\Sources\Product\Local .testsettings" /searchpathroot:"C:\Builds\6\ProductName\BuildName\Sources\Mixed Platforms\Release" /resultsfileroot:"C:\Builds\6\ProductName\BuildName\TestResults" /testcontainer:"C:\Builds \6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Debug\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestCommon\bin\Release\UnitTestCommon.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\bin\Debug\UnitTestWCF.dll" /testcontainer:"C:\Builds\6\ProductName\BuildName\Sources\Test\UnitTestWCF\ bin\Release\UnitTestWCF.dll" /publish:"http://dctfs2010.company.dc:8080/tfs/Product" /publishbuild:"vstfs:///Build/Build/962" /teamproject:"ProductName" /平台:“混合平台”/flavor:“发布”目录“C:\ Builds\6\ProductName\BuildName\Sources\Mixed Platforms\Release" not found.未找到 Builds\6\ProductName\BuildName\Sources\Mixed Platforms\Release。

If you click on the properties of your solution (the solution that you build as part of your build).如果您单击解决方案的属性(作为构建的一部分构建的解决方案)。 You will have configuration manager.您将拥有配置管理器。 At the configuration manager you will be able to see 'Debug', 'Released', 'Mixed', etc any other configurations you may have defined.在配置管理器中,您将能够看到“调试”、“已发布”、“混合”等您可能定义的任何其他配置。 Can you see the test project checked to be build in the mixed configuration?你能看到测试项目被检查为在混合配置中构建吗? If this is not being build, the test.dll will not be available which means, MSBuild will not have any tests to run.如果这不是正在构建,则 test.dll 将不可用,这意味着 MSBuild 将没有任何要运行的测试。

Another way to verify why the tests are not running, is to look at the build drop directory and see if you can see the test.dll there.另一种验证测试为什么没有运行的方法是查看构建放置目录,看看是否可以在那里看到 test.dll。 If the test.dll is not there then the problem is with how you have the projects configured in the configuration manager.如果 test.dll 不存在,那么问题在于您如何在配置管理器中配置项目。

Turns out my outputDirectory was setup wrong for how our projects are compiled.原来我的 outputDirectory 设置错误,因为我们的项目是如何编译的。 Which is where the searchpathroot problem came from.这就是 searchpathroot 问题的来源。

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

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