Tfs构建vnext无法发布测试结果

时间:2016-10-17 10:27:51

标签: tfs nunit tfsbuild tfs2015 nunit-3.0

我有一个带有TFS Build Vnext的流程,有2个测试步骤(同样,解决方案构建,......但这不是问题) 一个测试步骤用于单元测试,另一个用于集成测试。

集成测试的步骤很好,在步骤结束时在TFS中发布测试没问题,我在构建摘要中有图表。

但是,对于单元测试的步骤,TFS无法发布结果,我在构建输出中有此警告:

  

无法发布测试结果:startDate的值不属于   允许的值。

在我打开测试结果文件trx之前,我不明白为什么我有这个输出。

file.trx:

<Times creation="2016-10-17T12:08:09.1454974+02:00" queuing="2016-10-17T12:08:09.1454974+02:00" start="0001-01-01 00:00:00Z" finish="2016-10-17T12:09:26.9725722+02:00" />

TFS不会影响节点Times中属性start的正确值。 为什么? 我有~80个集成测试和~1400个单元测试,它是单元测试的数量吗?或其他什么?

我尝试删除单元测试步骤并重新创建它。

技术信息: 测试框架:

  • Nunit 3.5.0与Nunit VS Test Adapter 3.4.1
  • 满足所有要求的TFS 2015
  • 使用的任务:Visual Studio测试

例如,我试图将Nunit降级到3.4.1以满足使用适配器的版本,它没有改变任何东西。

测试任务配置(两个测试任务的配置相同):

  • 执行选项:
    • 测试组件:一个组件
    • 运行设置文件:见下文
    • 代码覆盖率已启用:true
    • 并行运行:true
  • 高级执行选项:
    • VSTest版本:VS 2015
  • 报告选项:
    • 平台:任何cpu
    • 配置:发布
    • 上传测试附件:true

RunSettings文件:

<?xml version="1.0" encoding="utf-8"?>
<!-- File name extension must be .runsettings -->
<RunSettings>
  <RunConfiguration>
    <TreatTestAdapterErrorsAsWarnings>true</TreatTestAdapterErrorsAsWarnings>
    <ResultsDirectory>.\TestResults</ResultsDirectory>
  </RunConfiguration>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <Configuration>
          <CodeCoverage>
            <!--
            About include/exclude lists:
            Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
            Each element in the list is a regular expression (ECMAScript syntax). See http://msdn.microsoft.com/library/2k3te2cs.aspx.
            An item must first match at least one entry in the include list to be included.
            Included items must then not match any entries in the exclude list to remain included.
            -->

            <!-- Match assembly file paths: -->
            <ModulePaths>
              <Include>
                <ModulePath>.*\.dll$</ModulePath>
                <ModulePath>.*\.exe$</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*tests.*.dll</ModulePath>
              </Exclude>
            </ModulePaths>

            <!-- Match fully qualified names of functions: -->
            <!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.)  -->
            <Functions>
              <Exclude>                    
              </Exclude>
            </Functions>

            <!-- Match attributes on any code element: -->
            <Attributes>
              <Exclude>
                <!-- Don't forget "Attribute" at the end of the name -->

                <Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
                <Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
                <Attribute>^System\.Runtime\.CompilerServices.CompilerGeneratedAttribute$</Attribute>
                <Attribute>^System\.CodeDom\.Compiler.GeneratedCodeAttribute$</Attribute>
                <Attribute>^System\.Diagnostics\.CodeAnalysis.ExcludeFromCodeCoverageAttribute$</Attribute>
              </Exclude>
            </Attributes>

            <!-- Match the path of the source files in which each method is defined: -->
            <Sources>
              <Exclude>
                <Source>.*\\atlmfc\\.*</Source>
                <Source>.*\\vctools\\.*</Source>
                <Source>.*\\public\\sdk\\.*</Source>
                <Source>.*\\microsoft sdks\\.*</Source>
                <Source>.*\\vc\\include\\.*</Source>
              </Exclude>
            </Sources>

            <!-- Match the company name property in the assembly: -->
            <CompanyNames>
              <Exclude>
                <CompanyName>.*microsoft.*</CompanyName>
              </Exclude>
            </CompanyNames>

            <!-- Match the public key token of a signed assembly: -->
            <PublicKeyTokens>
              <!-- Exclude Visual Studio extensions: -->
              <Exclude>
                <PublicKeyToken>^B77A5C561934E089$</PublicKeyToken>
                <PublicKeyToken>^B03F5F7F11D50A3A$</PublicKeyToken>
                <PublicKeyToken>^31BF3856AD364E35$</PublicKeyToken>
                <PublicKeyToken>^89845DCD8080CC91$</PublicKeyToken>
                <PublicKeyToken>^71E9BCE111E9429C$</PublicKeyToken>
                <PublicKeyToken>^8F50407C4E9E73B6$</PublicKeyToken>
                <PublicKeyToken>^E361AF139669C375$</PublicKeyToken>
              </Exclude>
            </PublicKeyTokens>


            <!-- We recommend you do not change the following values: -->
            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
            <CollectFromChildProcesses>True</CollectFromChildProcesses>
            <CollectAspDotNet>False</CollectAspDotNet>

          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

测试任务日志(法语):

2016-10-18T07:54:21.4325873Z Exécution du script PowerShell : C:\agent\tasks\VSTest\1.0.32\VSTest.ps1
2016-10-18T07:54:21.5107118Z ##[debug]Calling Invoke-VSTest for all test assemblies
2016-10-18T07:54:21.6669608Z Working folder: C:\agent\_work\4
2016-10-18T07:54:21.6669608Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\agent\_work\4\s\EDM 1-dev\Programs and Components\API\Archimed.Edm.Tests\bin\Release\Archimed.Edm.UnitTests.dll"  /Settings:"C:\Users\TFSBUILD\AppData\Local\Temp\tmpAE1E.tmp" /EnableCodeCoverage /logger:trx /TestAdapterPath:"C:\agent\_work\4\s"
2016-10-18T07:54:21.8700845Z Microsoft (R) Test Execution Command Line Tool Version 14.0.25123.0
2016-10-18T07:54:21.8700845Z Copyright (c) Microsoft Corporation.  Tous droits réservés.
2016-10-18T07:54:22.2138323Z Démarrage de l'exécution du test, veuillez patienter...
2016-10-18T07:54:27.4169240Z Informations : NUnit Adapter 3.4.1.0: Test execution started
2016-10-18T07:54:27.4325489Z Informations : Running all tests in C:\agent\_work\4\s\........\bin\Release\UnitTests.dll
2016-10-18T07:54:28.9169144Z Informations : NUnit3TestExecutor converted 1265 of 1265 NUnit test cases
... Tests
2016-10-18T07:55:44.9787034Z Informations : NUnit Adapter 3.4.1.0: Test execution complete
... Tests
2016-10-18T07:55:45.5724420Z Fichier de résultats : C:\Users\TFSBUILD\AppData\Local\Temp\TestResults\tfsbuild_TFSBUILD-GED 2016-10-18 09_54_31.trx
2016-10-18T07:55:45.5724420Z Pièces jointes :
2016-10-18T07:55:45.5724420Z   C:\Users\TFSBUILD\AppData\Local\Temp\TestResults\eb407547-19e7-4485-8b35-44f8e51f344e\tfsbuild_TFSBUILD-GED 2016-10-18 09_54_24.coverage
2016-10-18T07:55:45.5724420Z Nombre total de tests : 1265. Réussite : 1241. Échec : 0. Ignorés : 0.
2016-10-18T07:55:45.5724420Z Test correctement exécuté.
2016-10-18T07:55:45.5724420Z Délai d'exécution des tests : 1,3805 Minutes
2016-10-18T07:55:45.6974396Z Publication des résultats des tests...
2016-10-18T07:55:46.1505559Z ##[warning]Échec de la publication des résultats des tests : La valeur de la propriété startDate ne fait pas partie des valeurs admises pour cette dernière.

1 个答案:

答案 0 :(得分:0)

我没有改变任何事情,任务设置或tfs设置。 现在,它正在运作。我不明白。