-
Notifications
You must be signed in to change notification settings - Fork 390
Expand file tree
/
Copy pathTests.targets
More file actions
120 lines (100 loc) · 6.97 KB
/
Copy pathTests.targets
File metadata and controls
120 lines (100 loc) · 6.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<AutoGenerateBindingRedirects Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">true</AutoGenerateBindingRedirects>
<_GetTestsToRunTarget Condition="'$(TargetFrameworks)' == ''">_InnerGetTestsToRun</_GetTestsToRunTarget>
<_GetTestsToRunTarget Condition="'$(TargetFrameworks)' != ''">_OuterGetTestsToRun</_GetTestsToRunTarget>
<!-- The runtime to run tests on: 'Core', 'Mono', 'Full' (desktop FX). -->
<TestRuntime Condition="'$(TestRuntime)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">Core</TestRuntime>
<TestRuntime Condition="'$(TestRuntime)' == '' and '$(MSBuildRuntimeType)' == 'Mono'">Mono</TestRuntime>
<TestRuntime Condition="'$(TestRuntime)' == '' and '$(OS)' == 'Windows_NT'">Full</TestRuntime>
<TestRunnerName Condition="'$(TestRunnerName)' == ''">XUnit</TestRunnerName>
<TestRunnerName Condition="'$(UsingToolXUnit)' == 'false'"></TestRunnerName>
<!--
Look for the specified test runner in the building repository first.
If we can't find it see if the requested test runner provided by the Arcade SDK.
-->
<TestRunnerTargets>$(RepositoryEngineeringDir)$(TestRunnerName)\$(TestRunnerName).targets</TestRunnerTargets>
<TestRunnerTargets Condition="!Exists($(TestRunnerTargets))">$(MSBuildThisFileDirectory)$(TestRunnerName)\$(TestRunnerName).targets</TestRunnerTargets>
</PropertyGroup>
<Target Name="ErrorForMissingTestRunner" Condition="'$(IsTestProject)' == 'true' AND '$(TestRunnerName)' != ''">
<Error Condition="!Exists($(TestRunnerTargets))" Text="Test runner $(TestRunnerName) is invalid."/>
</Target>
<!--
Phase 1 of the test-runner consolidation effort. See
Documentation/TestRunnerConsolidation.md for the full plan.
We warn when a project opts into a code path that is scheduled for
removal so that downstream repos can migrate before the next major
Arcade release. Suppress by setting:
<NoWarn>$(NoWarn);ARCADE0001;ARCADE0002</NoWarn>
-->
<Target Name="_WarnDeprecatedTestRunnerOptions"
Condition="'$(IsTestProject)' == 'true' AND '$(SuppressArcadeTestRunnerDeprecationWarnings)' != 'true'"
BeforeTargets="Test;IntegrationTest;Build">
<Warning Code="ARCADE0001"
Text="The 'UsingToolXUnit' property is deprecated and will be removed in a future Arcade release. Use the 'TestRunnerName' property (e.g. TestRunnerName=XUnitV3) to select a test runner. See Documentation/TestRunnerConsolidation.md."
Condition="'$(_UsingToolXUnitExplicitlySet)' == 'true'" />
<Warning Code="ARCADE0002"
Text="The 'UseVSTestRunner' property is deprecated and the VSTest-based runner path will be removed in a future Arcade release. Migrate to Microsoft.Testing.Platform (the default for xUnit v3 and MSTest 4.x). See Documentation/TestRunnerConsolidation.md."
Condition="'$(UseVSTestRunner)' == 'true'" />
</Target>
<PropertyGroup Condition="'$(IsTestProject)' == 'true' and '$(TestArchitectures)' == ''">
<TestArchitectures>$(PlatformTarget)</TestArchitectures>
<TestArchitectures Condition="'$(PlatformTarget)' == '' or '$(PlatformTarget)' == 'AnyCpu'">x64</TestArchitectures>
</PropertyGroup>
<Target Name="Test" DependsOnTargets="ErrorForMissingTestRunner;$(_GetTestsToRunTarget);RunTests" Condition="'$(IsUnitTestProject)' == 'true' or '$(IsPerformanceTestProject)' == 'true'" />
<Target Name="IntegrationTest" DependsOnTargets="ErrorForMissingTestRunner;$(_GetTestsToRunTarget);RunTests" Condition="'$(IsIntegrationTestProject)' == 'true'" />
<ItemGroup>
<_TestArchitectureItems Include="$(TestArchitectures)" />
</ItemGroup>
<!-- Using Inputs/Outputs just to loop over test architectures -->
<Target Name="_InnerGetTestsToRun"
Outputs="%(_TestArchitectureItems.Identity)"
Returns="@(TestToRun)"
DependsOnTargets="ComputeRunArguments"
Condition="'$(TestRuntime)' != '' and '$(SkipTests)' != 'true' and
('$(TestTargetFrameworks)' == '' or $([System.String]::new(';$(TestTargetFrameworks);').Contains(';$(TargetFramework);')))">
<PropertyGroup>
<_TestArchitecture>%(_TestArchitectureItems.Identity)</_TestArchitecture>
<_ResultFileNameNoExt>$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture)</_ResultFileNameNoExt>
<!-- Send the logs into the default location, unless overriden by the consumer -->
<TestResultsLogDir Condition=" '$(TestResultsLogDir)' == '' ">$(ArtifactsLogDir)</TestResultsLogDir>
</PropertyGroup>
<ItemGroup>
<TestToRun Include="$(TargetPath)">
<TargetFramework>$(TargetFramework)</TargetFramework>
<TargetFrameworkIdentifier>$(TargetFrameworkIdentifier)</TargetFrameworkIdentifier>
<TargetFrameworkVersion>$(TargetFrameworkVersion)</TargetFrameworkVersion>
<TestRuntime>$(TestRuntime)</TestRuntime>
<TestTimeout>$(TestTimeout)</TestTimeout>
<Architecture>$(_TestArchitecture)</Architecture>
<EnvironmentDisplay>$(TargetFramework)|$(_TestArchitecture)</EnvironmentDisplay>
<ResultsFilePathWithoutExtension>$(_ResultFileNameNoExt)</ResultsFilePathWithoutExtension>
<ResultsXmlPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).xml</ResultsXmlPath>
<ResultsTrxPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).trx</ResultsTrxPath>
<ResultsHtmlPath>$(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).html</ResultsHtmlPath>
<ResultsStdOutPath>$(TestResultsLogDir)$(_ResultFileNameNoExt).log</ResultsStdOutPath>
<TestRunSettingsFile>$(TestRunSettingsFile)</TestRunSettingsFile>
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments)</TestRunnerAdditionalArguments>
<IsTestingPlatformApplication>$(IsTestingPlatformApplication)</IsTestingPlatformApplication>
<RunArguments>$(RunArguments)</RunArguments>
<RunCommand>$(RunCommand)</RunCommand>
</TestToRun>
</ItemGroup>
</Target>
<Target Name="_OuterGetTestsToRun" Returns="@(TestToRun)">
<ItemGroup>
<_TargetFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)"
Condition="'$(TargetFrameworks)' != ''"
Targets="_InnerGetTestsToRun"
Properties="TargetFramework=%(_TargetFramework.Identity)">
<Output ItemName="TestToRun" TaskParameter="TargetOutputs" />
</MSBuild>
</Target>
<!-- Import specialized targets files of supported test runners -->
<Import Project="$(TestRunnerTargets)" Condition="'$(IsTestProject)' == 'true' and '$(TestRunnerName)' != '' and Exists('$(TestRunnerTargets)')"/>
<!-- Allow for repo specific Test targets such as rerunning tests -->
<Import Project="$(RepositoryEngineeringDir)Tests.targets" Condition="Exists('$(RepositoryEngineeringDir)Tests.targets')" />
</Project>