Skip to content

Commit

Permalink
Move test results into TestResults directory (dotnet#35829)
Browse files Browse the repository at this point in the history
and avoid unique test results name as VSTest has issues with that.
Disabling capturing blame mode dumps at the moment until we have
cross-plat support for it.
Cleaning the results directory if the code coverage data collector is
used as there's currently not an easy way to distinguish between a new
and an old coverage results file. See tracking issue.
  • Loading branch information
ViktorHofer authored May 5, 2020
1 parent 7ddda11 commit b9467c8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<MicrosoftNETTestSdkVersion>16.7.0-preview-20200429-01</MicrosoftNETTestSdkVersion>
<MicrosoftDotNetXHarnessTestsRunnersVersion>1.0.0-prerelease.20254.1</MicrosoftDotNetXHarnessTestsRunnersVersion>
<XUnitVersion>2.4.1</XUnitVersion>
<CoverletCollectorVersion>1.2.0</CoverletCollectorVersion>
<CoverletCollectorVersion>1.2.1</CoverletCollectorVersion>
<TraceEventVersion>2.0.5</TraceEventVersion>
<NewtonsoftJsonVersion>12.0.3</NewtonsoftJsonVersion>
<MoqVersion>4.12.0</MoqVersion>
Expand Down
20 changes: 4 additions & 16 deletions eng/testing/.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- Timeout in ms, 5 minutes -->
<TestSessionTimeout>300000</TestSessionTimeout>
<!-- Directory for test run reports. E.g. trx, coverage etc. -->
<ResultsDirectory>.\</ResultsDirectory>
<ResultsDirectory>.\TestResults\</ResultsDirectory>
<!-- Working directory for test invocation. Results directory can be relative to this. Used by IDEs. -->
<SolutionDirectory>.\</SolutionDirectory>
<!-- Degree of parallelization, spawns n test hosts to run tests. -->
Expand All @@ -25,16 +25,8 @@
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger uri="logger://Microsoft/TestPlatform/TrxLogger/v1">
<Configuration>
<LogFileName>testResults.trx</LogFileName>
</Configuration>
</Logger>
<Logger uri="logger://Microsoft/TestPlatform/HtmlLogger/v1">
<Configuration>
<LogFileName>testResults.html</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="trx" />
<Logger friendlyName="html" />
<Logger friendlyName="console">
<Configuration>
<Verbosity>Minimal</Verbosity>
Expand All @@ -55,11 +47,7 @@
<IncludeTestAssembly>false</IncludeTestAssembly>
</Configuration>
</DataCollector>
<DataCollector friendlyName="blame" enabled="true">
<Configuration>
<CollectDump CollectAlways="false" DumpType="mini" />
</Configuration>
</DataCollector>
<DataCollector friendlyName="blame" enabled="true" />
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
4 changes: 2 additions & 2 deletions eng/testing/coverage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
Condition="'$(Coverage)' == 'true' and '$(SkipCoverageReport)' != 'true'"
AfterTargets="VSTest">
<ItemGroup Condition="'$(CoverageReportInputPath)' == ''">
<CoverageOutputFile Include="$(OutDir)*\coverage.opencover.xml" />
<CoverageOutputFile Include="$(OutDir)TestResults\*\coverage.opencover.xml" />
</ItemGroup>

<PropertyGroup>
<CoverageReportInputPath Condition="'$(CoverageReportInputPath)' == ''">%(CoverageOutputFile.Identity)</CoverageReportInputPath>
<CoverageReportTypes Condition="'$(CoverageReportTypes)' == ''">Html</CoverageReportTypes>
<CoverageReportVerbosity Condition="'$(CoverageReportVerbosity)' == ''">Info</CoverageReportVerbosity>
<CoverageReportDir Condition="'$(CoverageReportDir)' == ''">$([MSBuild]::NormalizeDirectory('$(OutDir)', 'report'))</CoverageReportDir>
<CoverageReportDir Condition="'$(CoverageReportDir)' == ''">$([MSBuild]::NormalizeDirectory('$(OutDir)', 'TestResults', 'report'))</CoverageReportDir>
<CoverageReportCommand>"$(DotNetTool)" tool run reportgenerator "-reports:$(CoverageReportInputPath)" "-targetdir:$(CoverageReportDir.TrimEnd('\/'))" "-reporttypes:$(CoverageReportTypes)" "-verbosity:$(CoverageReportVerbosity)"</CoverageReportCommand>
</PropertyGroup>

Expand Down
11 changes: 11 additions & 0 deletions eng/testing/runsettings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@
<RunSettingsFilePath>$(RunSettingsOutputFilePath)</RunSettingsFilePath>
</PropertyGroup>
</Target>

<!--
Clean the test results directory to guarantee that a report is generated from the
newest coverage results file.
Tracking issue https://github.com/microsoft/vstest/issues/2378.
-->
<Target Name="ClearTestResults"
BeforeTargets="VSTest"
Condition="'$(Coverage)' == 'true'">
<RemoveDir Directories="$(OutDir)TestResults" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- For tests we want to continue running if a test run failed. -->
<TestContinueOnError>ErrorAndContinue</TestContinueOnError>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
<CoverageReportInputPath>$(ArtifactsBinDir)*.Tests\*\coverage.opencover.xml</CoverageReportInputPath>
<CoverageReportInputPath>$(ArtifactsBinDir)*.Tests\TestResults\*\coverage.opencover.xml</CoverageReportInputPath>
<CoverageReportDir>$(ArtifactsDir)coverage</CoverageReportDir>
<EnableCoverageSupport>true</EnableCoverageSupport>
</PropertyGroup>
Expand Down

0 comments on commit b9467c8

Please sign in to comment.