Skip to content

Azure Devops Pipeline with a new MSTest runner 3.2.0 #2175

Closed

Description

Hi,

can anybody share pipeline steps to build/run tests with code coverage and test results?
Or perhaps anybody can help me modify my pipeline to support MSTestRunner?
Thanks!

This is a new project with 3.2.0 runner. What should I change in the pipeline to make it work?

  <PropertyGroup>
    <EnableMSTestRunner>true</EnableMSTestRunner>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.0" />
    <PackageReference Include="MSTest" Version="3.2.0" />
  </ItemGroup>
 </PropertyGroup>

My pipeline:

 - task: DotNetCoreCLI@2
    displayName: Build solution
    inputs:
      command: "build"
      projects: '**/Solution.sln'
      arguments: '-c Release'

  - task: DotNetCoreCLI@2
    displayName: Run unit tests
    continueOnError: true
    inputs:
      command: 'test'
      projects: '**/Solution.sln'
      arguments: '-c Release --results-directory "$(Build.SourcesDirectory)/TestResults/Coverage/" --collect "XPlat Code Coverage" --logger trx'
      publishTestResults: false

  - task: reportgenerator@5
    displayName: Generate code coverage report
    inputs:
      reports: '$(Build.SourcesDirectory)/TestResults/Coverage/*/coverage.cobertura.xml'
      targetdir: '$(Build.SourcesDirectory)/TestResults/CoverageReport'

  - task: PublishCodeCoverageResults@1
    displayName: Publish code coverage results
    inputs:
      codeCoverageTool: "Cobertura"
      summaryFileLocation: "$(Build.SourcesDirectory)/TestResults/CoverageReport/Cobertura.xml"
      reportDirectory: "$(Build.SourcesDirectory)/TestResults/CoverageReport"

  - task: PublishTestResults@2
    displayName: Publish test results
    inputs:
      testResultsFormat: 'VSTest'
      testResultsFiles: '**/*.trx'
      searchFolder: '$(Build.SourcesDirectory)/TestResults/Coverage'
      mergeTestResults: true

Activity

  1. Evangelink commented on Jan 26, 2024

    @Evangelink
    Member

    Hi Dimitri Kroo (@SymbioticKilla),

    MSTest runner has a compatibility layer with the past so you could run your pipeline as-is (you won't get the benefit of the new features/perfs...).

    If you want to take full advantage of the runner, you should be following this doc page for enabling dotnet test with the runner.

    For the code coverage, if you want to use coverlet (as there is currently no specific adapter), you will have to use the global tool. Please refer to coverlet doc page https://github.com/coverlet-coverage/coverlet#net-global-tool-guide-suffers-from-possible-known-issue. If you don't mind using Microsoft Code Coverage (which we recommend - check out this article for some of the reasons https://devblogs.microsoft.com/dotnet/whats-new-in-our-code-coverage-tooling/?utm_content=buffer9eae6&utm_medium=social&utm_source=linkedin.com&utm_campaign=buffer), then you can use the following configuration.

    Project

      <PropertyGroup>
        <EnableMSTestRunner>true</EnableMSTestRunner>
        <OutputType>Exe</OutputType>
        <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.0" />
        <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1" />
        <PackageReference Include="MSTest" Version="3.2.0" />
      </ItemGroup>
     </PropertyGroup>

    My pipeline:

     - task: DotNetCoreCLI@2
        displayName: Build solution
        inputs:
          command: "build"
          projects: '**/Solution.sln'
          arguments: '-c Release'
    
      - task: DotNetCoreCLI@2
        displayName: Run unit tests
        continueOnError: true
        inputs:
          command: 'test'
          projects: '**/Solution.sln'
          arguments: '-c Release -p:TestingPlatformCommandLineArguments=" --results-directory \"$(Build.SourcesDirectory)/TestResults/Coverage/\" --report-trx --coverage --coverage-output-format covertura "'
          publishTestResults: false
    
      - task: reportgenerator@5
        displayName: Generate code coverage report
        inputs:
          reports: '$(Build.SourcesDirectory)/TestResults/Coverage/*/coverage.cobertura.xml'
          targetdir: '$(Build.SourcesDirectory)/TestResults/CoverageReport'
    
      - task: PublishCodeCoverageResults@1
        displayName: Publish code coverage results
        inputs:
          codeCoverageTool: "Cobertura"
          summaryFileLocation: "$(Build.SourcesDirectory)/TestResults/CoverageReport/Cobertura.xml"
          reportDirectory: "$(Build.SourcesDirectory)/TestResults/CoverageReport"
    
      - task: PublishTestResults@2
        displayName: Publish test results
        inputs:
          testResultsFormat: 'VSTest'
          testResultsFiles: '**/*.trx'
          searchFolder: '$(Build.SourcesDirectory)/TestResults/Coverage'
          mergeTestResults: true
    
  2. added
    type/discussion
    needs/author-feedback
    area/mtp
    on Jan 26, 2024
  3. SymbioticKilla commented on Jan 27, 2024

    @SymbioticKilla
    Author

    Amaury Levé (@Evangelink)
    Thank you! You are awesome!

    I have changed couple of things in your proposal for pipeline:
    1.) Typo fix: covertura => cobertura

    --coverage-output-format cobertura 

    2.) reportgenerator@5 => Structure for code coverage output is different. The reports folder and name are changed

    reports: '$(Build.SourcesDirectory)/TestResults/Coverage/*.cobertura.xml'

    3.) Disable autogenerate in PublishCodeCoverageResults@1

        env:
          DISABLE_COVERAGE_AUTOGENERATE: 'true'

    I have couple of questions:
    1.) Is this setup that you have provided uses all (performance) improvements? Is there any refactoring that you can advise?
    2.) How I can create or find sample tests to check performance improvements in the pipeline? Some sort of benchmark to show improvements in my team. Our tests are too fast (<1 Minute) I need something bigger :)

    Thanks!

  4. added
    needs/attention
    and removed
    needs/author-feedback
    on Jan 27, 2024
  5. Evangelink commented on Jan 28, 2024

    @Evangelink
    Member

    Sorry for the missed edits and typos, I wrote by head on GH so didn't get much safetynet :(

    For code coverage improvements, Jakub Chocholowicz (@jakubch1) will give you some details.

    1.) Is this setup that you have provided uses all (performance) improvements?

    You should have it all (assuming you updated the test projects as stated in the guide).

    There is one extra thing, if you are not using MSTest metapackage but reference MSTest.TestAdapter and MSTest.TestFramework then please add MSTest.Analyzers and I strongly suggest enabling the [assembly: Parallelize(Scope = ExecutionScope.Method)] (once again by head on GH so there might be a typo). For now, MSTest runs tests in sequence by default and not in parallel. This would be the best and biggest perf improvement you can do :)

    Is there any refactoring that you can advise?

    You can add the --no-restore and --no-build arguments on your dotnet test call (see https://learn.microsoft.com/dotnet/core/tools/dotnet-test#options) as you have a separate build step.

    2.) How I can create or find sample tests to check performance improvements in the pipeline? Some sort of benchmark to show improvements in my team. Our tests are too fast (<1 Minute) I need something bigger :)

    It depends how big you want, but you can refer to our samples of performance diff between VSTest and MSTest runner (https://github.com/microsoft/testfx/tree/main/samples/runner_vs_vstest#mstest-runner-vs-vstest)

  6. jakubch1 commented on Jan 29, 2024

    @jakubch1
    Member
  7. SymbioticKilla commented on Jan 29, 2024

    @SymbioticKilla
    Author

    Thank you!

    I have tried to check performance. It is weird... With a new MSTest Runner the tests are slower.
    We are using .NET7, but I have also tried with .NET8.
    Build Agents are linux based.

    1.) Test step with a new MS Test Runner in Azure Devops:

    /_work/_tool/dotnet/dotnet test /_work/11/s/Source/Solution.sln --no-restore --no-build -c Release -p:TestingPlatformCommandLineArguments= --results-directory "/_work/11/s/TestResults/Coverage/" --report-trx --coverage --coverage-output-format cobertura

    Execution time: ~12 seconds

    2.) Test step with an old VSTest

    /_work/_tool/dotnet/dotnet test /_work/18/s/Source/Solution.sln --no-restore --no-build -c Release --results-directory /_work/18/s/TestResults/Coverage/ --collect XPlat Code Coverage --logger trx

    Execution time: ~6 Seconds

    New tests .csproj:

      <PropertyGroup>
        <EnableMSTestRunner>true</EnableMSTestRunner>
        <OutputType>Exe</OutputType>
        <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.0" />
        <PackageReference Include="MSTest" Version="3.2.0" />
        <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1" />
        <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
          <PrivateAssets>all</PrivateAssets>
          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
        <PackageReference Include="System.Linq.Async" Version="6.0.1" />
      </ItemGroup>
  8. nohwnd commented on Jan 30, 2024

    @nohwnd
    Member

    Could you please share a bit more detail about your solution? (Unless it is opensource and you can just link me to your repo :)) I would like to investigate this, but we only heard about one similar issue that is using a custom ITestDataSource, and there we still don't know the cause because it is huge and super hard to build.

    • How many projects are there in your solution?
    • Are you using multiple target frameworks in your csproj?
    • Are there any customizations you are using for the testing framework? Like I ITestDataSource, inherited attributes from [TestMethod] or [TestClass]?
    • Do you see the same problem when you don't use code coverage?
    • Do you see the same problem when you don't use TRX?

    You could also create a VS feedback ticket (https://developercommunity.visualstudio.com/home) and privately attach any logs that you can collect, or a subset of your solution that reproes the issue.

    collecting logs of runner: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-runner-extensions#built-in-options

    collecting logs of VSTEST: https://github.com/microsoft/vstest/blob/main/docs/diagnose.md

  9. Evangelink commented on Jan 30, 2024

    @Evangelink
    Member

    Jakub Jareš (@nohwnd) I think he just setup some CI using the perf samples we have in the repo:

    It depends how big you want, but you can refer to our samples of performance diff between VSTest and MSTest runner (https://github.com/microsoft/testfx/tree/main/samples/runner_vs_vstest#mstest-runner-vs-vstest)

  10. nohwnd commented on Jan 31, 2024

    @nohwnd
    Member

    I've tried this on my local windows system, and I am seeing 6 seconds on my trivial test solution with 2 projects and 2 tests (in total), when coverlet is enabled.

    Are you running the old command against the same solution as the new one? The new solution does not have coverlet installed in the project, and so the whole overhead of coverage is skipped.

    My proj for comparison

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    
        <IsPackable>false</IsPackable>
        <IsTestProject>true</IsTestProject>
      </PropertyGroup>
    
      <PropertyGroup>
        <EnableMSTestRunner>true</EnableMSTestRunner>
        <OutputType>Exe</OutputType>
        <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.0" />
        <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1"  Condition=" $(TestingPlatformDotnetTestSupport) == 'true'" />
        <PackageReference Include="MSTest" Version="3.2.0" />
    
        <PackageReference Include="coverlet.collector" Version="1.0.1" Condition=" $(TestingPlatformDotnetTestSupport) == 'false'" />
      </ItemGroup>
    
    </Project>

    Old + coverlet: ~7s
    Old without coverlet: ~3s
    New with coverage: ~3s
    New without coverage: ~2.5s

    Old + coverlet:

    S:\c\mstest-runner-perf1 [main ≡ +4 ~0 -0 !]> dotnet build ; $sw = [diagnostics.stopwatch]::StartNew(); dotnet test .\mstest-runner-perf1.sln -c Release --collect "XPlat Code Coverage" --logger trx -p:TestingPlatformDotnetTestSupport=false; $sw.Elapsed
    MSBuild version 17.8.3+195e7f5a3 for .NET
      Determining projects to restore...
      Restored S:\c\mstest-runner-perf1\mstest2\mstest2.csproj (in 550 ms).
      Restored S:\c\mstest-runner-perf1\mstest1\mstest1.csproj (in 550 ms).
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Debug\net8.0\mstest2.dll
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Debug\net8.0\mstest1.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:01.65
      Determining projects to restore...
      Restored S:\c\mstest-runner-perf1\mstest1\mstest1.csproj (in 283 ms).
      Restored S:\c\mstest-runner-perf1\mstest2\mstest2.csproj (in 283 ms).
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll
    Test run for S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll (.NETCoreApp,Version=v8.0)
    Test run for S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll (.NETCoreApp,Version=v8.0)
    Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Starting test execution, please wait...
    Starting test execution, please wait...
    A total of 1 test files matched the specified pattern.
    A total of 1 test files matched the specified pattern.
      Failed TestMethod1 [13 ms]
      Error Message:
       Test method mstest1.UnitTest1.TestMethod1 threw exception:
    System.NotImplementedException: The method or operation is not implemented.
      Stack Trace:
          at mstest1.UnitTest1.TestMethod1() in S:\c\mstest-runner-perf1\mstest1\UnitTest1.cs:line 9
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
       at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    
    Results File: S:\c\mstest-runner-perf1\mstest1\TestResults\jajares_RDESKTOP_2024-01-31_13_38_04.trx
    
    Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: 26 ms - mstest1.dll (net8.0)
    Results File: S:\c\mstest-runner-perf1\mstest2\TestResults\jajares_RDESKTOP_2024-01-31_13_38_05.trx
    
    Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 13 ms - mstest2.dll (net8.0)
    
    Attachments:
      S:\c\mstest-runner-perf1\mstest1\TestResults\c9558f74-136d-4de2-b1f1-baee372b0d86\coverage.cobertura.xml
      S:\c\mstest-runner-perf1\mstest2\TestResults\811dd118-056b-4435-821d-97e1d5a0cc1b\coverage.cobertura.xml
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 7
    Milliseconds      : 138
    Ticks             : 71388875
    TotalDays         : 8.26260127314815E-05
    TotalHours        : 0.00198302430555556
    TotalMinutes      : 0.118981458333333
    TotalSeconds      : 7.1388875
    TotalMilliseconds : 7138.8875
    
    

    Old without coverlet

     dotnet build ; $sw = [diagnostics.stopwatch]::StartNew(); dotnet test .\mstest-runner-perf1.sln -c Release --collect "XPlat Code Coverage" --logger trx ; $sw.Elapsed
    MSBuild version 17.8.3+195e7f5a3 for .NET
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Debug\net8.0\mstest2.dll
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Debug\net8.0\mstest1.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:00.84
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll
      Run tests: 'S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll' [net8.0|x64]
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll
      Run tests: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    C:\Users\jajares\.nuget\packages\microsoft.testing.platform.msbuild\1.0.0\buildMultiTargeting\Microsoft.Testing.Platform.MSBuild.targets(221,5): error : Tests failed: 'S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\TestResults\mstest1_net8.0_x64.log' [net8.0|x64] [S:\c\mstest-r
    unner-perf1\mstest1\mstest1.csproj]
      Tests succeeded: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 2
    Milliseconds      : 461
    Ticks             : 24610995
    TotalDays         : 2.84849479166667E-05
    TotalHours        : 0.00068363875
    TotalMinutes      : 0.041018325
    TotalSeconds      : 2.4610995
    TotalMilliseconds : 2461.0995
    

    new with coverage:

     dotnet build ; $sw = [diagnostics.stopwatch]::startnew(); dotnet test -c Release -p:TestingPlatformCommandLineArguments=" --report-trx --coverage --coverage-output-format cobertura --results-directory ""s:\c\mstest-runner-perf1/TestResults/Coverage/"""; $sw.elapsed
    MSBuild version 17.8.3+195e7f5a3 for .NET
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Debug\net8.0\mstest2.dll
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Debug\net8.0\mstest1.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:00.85
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll
      Run tests: 'S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll' [net8.0|x64]
      Run tests: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    C:\Users\jajares\.nuget\packages\microsoft.testing.platform.msbuild\1.0.0\buildMultiTargeting\Microsoft.Testing.Platform.MSBuild.targets(221,5): error : Tests failed: 's:\c\mstest-runner-perf1\TestResults\Coverage\mstest1_net8.0_x64.log' [net8.0|x64] [S:\c\mstest-runner-perf1\mstest
    1\mstest1.csproj]
      Tests succeeded: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 2
    Milliseconds      : 778
    Ticks             : 27781809
    TotalDays         : 3.21548715277778E-05
    TotalHours        : 0.000771716916666667
    TotalMinutes      : 0.046303015
    TotalSeconds      : 2.7781809
    TotalMilliseconds : 2778.1809
    

    new without coverage

     dotnet build ; $sw = [diagnostics.stopwatch]::startnew(); dotnet test -c Release -p:TestingPlatformCommandLineArguments=" --report-trx --results-directory ""s:\c\mstest-runner-perf1/TestResults/Coverage/"""; $sw.elapsed
    MSBuild version 17.8.3+195e7f5a3 for .NET
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Debug\net8.0\mstest2.dll
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Debug\net8.0\mstest1.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:00.85
      Determining projects to restore...
      All projects are up-to-date for restore.
      mstest1 -> S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll
      Run tests: 'S:\c\mstest-runner-perf1\mstest1\bin\Release\net8.0\mstest1.dll' [net8.0|x64]
      mstest2 -> S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll
      Run tests: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    C:\Users\jajares\.nuget\packages\microsoft.testing.platform.msbuild\1.0.0\buildMultiTargeting\Microsoft.Testing.Platform.MSBuild.targets(221,5): error : Tests failed: 's:\c\mstest-runner-perf1\TestResults\Coverage\mstest1_net8.0_x64.log' [net8.0|x64] [S:\c\mstest-runner-perf1\mstest
    1\mstest1.csproj]
      Tests succeeded: 'S:\c\mstest-runner-perf1\mstest2\bin\Release\net8.0\mstest2.dll' [net8.0|x64]
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 2
    Milliseconds      : 222
    Ticks             : 22229631
    TotalDays         : 2.57287395833333E-05
    TotalHours        : 0.00061748975
    TotalMinutes      : 0.037049385
    TotalSeconds      : 2.2229631
    TotalMilliseconds : 2222.9631
    
  11. SymbioticKilla commented on Jan 31, 2024

    @SymbioticKilla
    Author

    Thanks for testing!
    I have tested with our project inside pipeline. I can't share the code :(
    I will check it locally and try your benchmark test projects as well.
    I hope I can do it this week.

  12. nohwnd commented on Jan 31, 2024

    @nohwnd
    Member

    Thanks, it would be helpful if you shared sanitized output of the build, if possible.

  13. 9 remaining items

  14. nohwnd commented on Feb 6, 2024

    @nohwnd
    Member

    Dimitri Kroo (@SymbioticKilla) We found the issue. We are hooking up to the VSTest target, which dotnet/sdk allows us to replace. In the original VStest task we conditionally build the tested project (to allow dotnet build -t:vstest, to work). In our new target we copied this approach, but forgot this condition, so every project will "build" again. "build" in quotes because it invokes msbuild, that does up-to-date check and returns, but it still takes a second or more per project.

    We will release a fix for this soon.

  15. added and removed
    type/discussion
    needs/attention
    on Feb 6, 2024
  16. SymbioticKilla commented on Feb 6, 2024

    @SymbioticKilla
    Author

    Glad to hear! Waiting to test 👍

  17. Evangelink commented on Feb 6, 2024

    @Evangelink
    Member

    Update: This is full guide to accessing our preview packages: https://aka.ms/mstest/preview

    Dimitri Kroo (@SymbioticKilla) would you be interested in testing the fix before its release? If so, you could use the following feed https://github.com/microsoft/testfx/blob/main/NuGet.config#L8. I'll get back to you with the min version that contains the fix.

  18. Evangelink commented on Feb 8, 2024

    @Evangelink
    Member

    Closing as done. We will reopen if there is still some issue for you.

  19. Evangelink commented on Feb 13, 2024

    @Evangelink
    Member

    Dimitri Kroo (@SymbioticKilla) MSTest 3.2.1 was just released

  20. SymbioticKilla commented on Feb 15, 2024

    @SymbioticKilla
    Author

    Amaury Levé (@Evangelink)
    Works perfect! x2 faster!
    I have just one regression with Microsoft.Testing.Extensions.TrxReport 1.0.1 on build agent (linux):
    /root/.nuget/packages/microsoft.testing.platform.msbuild/1.0.1/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets(225,5): error : Tests failed: '/_work/20/s/TestResults/Coverage/Project.Tests_net7.0_x64.log' [net7.0|x64]

    On windows (locally) is not reproducible.

    1.0.0 works as expected. Should I create a new bug report?

  21. Evangelink commented on Feb 15, 2024

    @Evangelink
    Member

    Works perfect! x2 faster!

    Love it!

    1.0.0 works as expected. Should I create a new bug report?

    Oh sorry! Yes please do! Could you try to provide some extra info about the project? Can you for example send me (by email or through developer community - please follow that link for how to upload private info https://learn.microsoft.com/cpp/overview/how-to-report-a-problem-with-the-visual-cpp-toolset?view=msvc-170#reports-and-privacy) the TRX that was produced before?

    I suspect there is something badly handled related to a fix we did on TRX for another customer.

  22. nohwnd commented on Feb 15, 2024

    @nohwnd
    Member

    I don't see the trx fail for my almost empty project when running under WSL. So that is a plus (that it does not fail always).

  23. SymbioticKilla commented on Feb 17, 2024

    @SymbioticKilla
    Author

    Jakub Jareš (@nohwnd) Amaury Levé (@Evangelink)
    Hi,

    I can reproduce it locally on my windows machine. You need to specify --results-directory:
    dotnet test Solution.sln -c Release --no-build --no-restore -d verbose -p:TestingPlatformCommandLineArguments="--results-directory "dev/TestResults/" --report-trx --coverage --coverage-output-format cobertura "

    The error: Unhandled exception. System.IO.IOException: The file 'C:\dev\TestResults\userName_PCName_2024-02-17_11_30_43.trx' already exists.

    With 1.0.0 it produces correctly all .trx files with milliseconds in the name. With 1.0.1 it produces same milliseconds values so the files have the same name. I have 4 test projects and it is a little bit random => 1+ projects succeed and other get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/mtp

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions