TFS 虽然构建是绿色的,但并非所有测试都运行 [英] TFS Not all tests are run although the build is green

查看:16
本文介绍了TFS 虽然构建是绿色的,但并非所有测试都运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我们大约有四分之一的测试没有在 TFS 上运行,构建最终显示为绿色,但只有 3/4 报告说所有测试都已通过.我猜问题出在一些经过测试的异步代码中,这些代码可能会使测试运行器崩溃或继续自行运行.在 VS 本地,所有测试都通过.有没有办法在 TFS 上启用故障转储,或者我应该如何解决这个问题?

For some reason about a quarter of our tests is not being run on TFS, build ends up green but reports only 3/4 saying all tests have passed. I guess the problem is in some tested async code that perhaps crashes the test runner or keeps running on its own. Locally in VS all tests are passing fine. Is there any way to enable crash dumps on TFS or how should I address this problem?

在 TFS Web 界面中,摘要显示所有 2217 测试均已通过",但在诊断部分,在已通过的测试中显示测试运行已完成.已执行 3228 次测试"……仍然不是全部(cca 3450 在本地通过VS2015)

In TFS web interface the Summary says "All 2217 tests passed" but in Diagnotics section, under the passed tests it says "Test run completed. 3228 tests executed" ...still not all (cca 3450 passing locally in VS2015)

我检查了服务器上的最后一个版本,但就历史而言,他们当时已经失败了(总是不同的 amonut 已经过去了).所以我无法追踪.

I checked last builds on the server but as far as the history goes, they were already failing then (always different amonut have passed). So I can't trace that.

我还使用 vstest.console.exe 进行了测试,一切都很好,除了在长文件路径上有 5 次失败(我禁用了忽略属性的那些无济于事)

I also ran tests with vstest.console.exe and all is fine except 5 failed on long filepath (I disabled those with Ignore attribbute to no avail)

由赏金发起人编辑:

对不起,赏金框中的文字.没想到换行符会被吞.在此处提供相同的文本.

Sorry for the text in bounty box. Didn't think that line breaks would be swallowed. Providing the same text here.

我有完全相同的情况.假设我有 100 个测试,但只说 60 个最终在 .trx 文件中(比如 50 个通过,10 个失败).解决这个问题会很棒.谢谢!

I have exact same situation. Say I have 100 tests, but only say 60 are finally in the .trx file (say 50 passed and 10 failed). It would be great to solve this issue. Thanks!

<Target Name="CoreTestConfiguration">
  <Exec Command="&quot;C:\Program Files\dotnet\dotnet.exe&quot; vstest /Blame /Diag:&quot;$(SolutionRoot)##########################\bin\Release\diag.txt&quot; &quot;$(SolutionRoot)###########################\#################s.dll&quot;  /logger:trx;LogFileName=&quot;$(SolutionRoot)\#################################\Tests\bin\Release\TestOutput.trx&quot; /Settings:&quot;$(SolutionRoot)\############################################ests\bin\Release\#################sts.runsettings&quot;"
  ContinueOnError="true"/>
</Target>


<RunSettings>
  <RunConfiguration>
    <TestSessionTimeout>4400000</TestSessionTimeout>
    <TestTimeout>342000</TestTimeout>
    <TargetPlatform>X64</TargetPlatform>
    <TargetFrameworkVersion>
        .NETCoreApp,Version=v2.0
    </TargetFrameworkVersion>

    <!-- same with net461: but different count of tests in final trx -->
    <!-- <TargetFrameworkVersion> 
        .NETFramework,Version=v4.6.1
    </TargetFrameworkVersion> -->

    <DesignMode>False</DesignMode>
    <CollectSourceInformation>False</CollectSourceInformation>
  </RunConfiguration>
  <LoggerRunSettings>
    <Loggers>
      <Logger friendlyName="blame" enabled="True" />
      <Logger friendlyName="Console" uri="logger://microsoft/TestPlatform/ConsoleLogger/v1" assemblyQualifiedName="Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger, vstest.console, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" codeBase="C:\Program Files\dotnet\sdk\2.1.503\vstest.console.dll" enabled="True" />
    </Loggers>
  </LoggerRunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="blame" enabled="True">
        <Configuration>
          <ResultsDirectory> 
            ############################\bin\Release
          </ResultsDirectory>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

推荐答案

您使用的是哪个版本的测试框架?您似乎想要构建/运行 dotnet 核心应用程序.在我看来,xunit 在 dotnet core 2.x 上运行良好.还有一个新版本的 MS 测试框架可用,其中有一些有趣的改进.我在最新的一篇 dotnetpro 文章中读到了这一点.也可以看看文章,dotnetpro(德国)

which version Test Framework are you using? It seems you want to build/run a dotnet core application. In my opinion xunit works fine with dotnet core 2.x. There is also a new version of MS Test framework available which has some interesting improvements. I read that in one of the latest dotnetpro article. see also Article, dotnetpro (GER)

希望这能帮助您解决此问题,拜拜莱昂哈德

Hopefully this will help you to solve this issue, See ya Leonhard

这篇关于TFS 虽然构建是绿色的,但并非所有测试都运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆