【问题标题】:Running VS2010 UnitTests project from TFS2008 Team Build从 TFS 2008 Team Build 运行 VS2010 单元测试项目
【发布时间】:2011-08-03 05:31:00
【问题描述】:

我有一个 Visual Studio 2010 MVC 3 应用程序,其中包含单元测试项目。我有一个 TFS 2008 构建定义来构建解决方案。

在构建代理上我安装了以下内容

但是当我运行构建时,我收到以下错误:-

Using "TestToolsTask" task from assembly "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.ProcessComponents.dll".
    Task "TestToolsTask"
      C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe /nologo /usestderr /searchpathroot:"c:\TFS\Core\Crime\Binaries\Release" /resultsfileroot:"c:\TFS\Core\Crime\TestResults" /testcontainer:"c:\TFS\Core\Crime\Binaries\Release\\Project1.UnitTests.dll" /testcontainer:"c:\TFS\Core\Crime\Binaries\Release\\Project2.UnitTests.dll" /testcontainer:"c:\TFS\Core\Crime\Binaries\Release\\Project3.UnitTests.dll" /testcontainer:"c:\TFS\Core\Crime\Binaries\Release\\Project4.UnitTests.dll" /publish:"http://server:8080/" /publishbuild:"vstfs:///Build/Build/88124" /teamproject:"Core" /platform:"Any CPU" /flavor:"Release" 
      Invalid switch "/publish".
      Invalid switch "/publishbuild".
      Invalid switch "/teamproject".
      Invalid switch "/platform".
      Invalid switch "/flavor".
      For switch syntax, type "MSTest /help"
    C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(1406,5,1406,5): warning : TF270015: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '1'. 
      The previous error was converted to a warning because the task was called with ContinueOnError=true.
    C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(1406,5): warning MSB4018: The "TestToolsTask" task failed unexpectedly. [c:\TFS\Core\Crime\BuildType\TFSBuild.proj]
    C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(1406,5): warning MSB4018: Microsoft.TeamFoundation.Build.Workflow.Activities.UnexpectedExitCodeException: TF270015: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '1'.

如果我通过命令行直接在构建服务器上运行 mstest 命令而不使用开关,它可以正常工作。我不明白为什么它试图添加这些开关。有什么想法吗?

【问题讨论】:

    标签: visual-studio-2010 tfs mstest


    【解决方案1】:

    您需要安装 VS 2010 Premium 或 Ultimate 才能在 MSTest.exe 中使用这些开关。您可以通过使用您想要的开关执行 MSTest 来解决这种问题,但是您不会在构建中看到很好的结果。

    【讨论】:

    【解决方案2】:

    添加开关是因为 MSTest 正在尝试将测试结果发布到服务器,以便您可以在团队构建资源管理器的构建日志中以及用于报告的多维数据集中查看信息等。

    假设您在安装 VS2010 Professional 时安装了 Team Explorer 2010,您应该能够发布测试结果(除非许可需要高级或终极 - 我不记得了)。可能值得重新安装并重新应用服务包,看看是否能解决问题。

    【讨论】:

      【解决方案3】:

      我的 dll 路径中的空格有问题。引号不起作用(可能是因为我错过了一些明显的东西?)。我的机器上没有安装 VS。

      【讨论】:

        猜你喜欢
        • 2011-07-08
        • 2013-09-01
        • 1970-01-01
        • 2010-09-22
        • 1970-01-01
        • 2011-10-05
        • 2011-01-29
        • 2011-05-03
        • 2023-03-31
        相关资源
        最近更新 更多