-
Notifications
You must be signed in to change notification settings - Fork 323
/
Microsoft.TestPlatform.targets
159 lines (143 loc) · 8.84 KB
/
Microsoft.TestPlatform.targets
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!--
***********************************************************************************************
Microsoft.TestPlatform.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Load Microsoft.TestPlatform.Build.Tasks.dll, this can be overridden to use a different version with $(VSTestTaskAssemblyFile) -->
<PropertyGroup>
<VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
<VSTestConsolePath Condition="$(VSTestConsolePath) == ''">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),"vstest.console.dll"))</VSTestConsolePath>
<VSTestNoBuild Condition="'$(VSTestNoBuild)' == ''">False</VSTestNoBuild>
<VsTestUseMSBuildOutput Condition="'$(VsTestUseMSBuildOutput)' == ''">False</VsTestUseMSBuildOutput>
</PropertyGroup>
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestTask2" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<!--
============================================================
Test target
Main entry point for running tests through vstest.console.exe
============================================================
-->
<Target Name="VSTest" DependsOnTargets="ShowInfoMessageIfProjectHasNoIsTestProjectProperty">
<!-- Unloggable colorized output (cf. https://github.com/microsoft/vstest/issues/680) -->
<!-- Fallback to this old view when terminal logger is not enabled (_MSBUILDTLENABLED==0) , or when user explicitly opts out (VsTestUseMSBuildOutput != true) -->
<CallTarget Targets="_VSTestConsole" Condition="$(_MSBUILDTLENABLED) == '0' OR !$(VsTestUseMSBuildOutput) OR $(MSBUILDENSURESTDOUTFORTASKPROCESSES) == '1'" />
<!-- Proper MSBuild integration, but no custom colorization -->
<!-- Use the new view whe terminal logger is enabled (_MSBUILDTLENABLED==0), and user did not opt out (VsTestUseMSBuildOutput == true) -->
<CallTarget Targets="_VSTestMSBuild" Condition="$(_MSBUILDTLENABLED) == '1' AND $(VsTestUseMSBuildOutput)" />
</Target>
<!--
Used when called from dotnet msbuild command line: uses MSBuild logs but does not allow for console colorization.
We call to empty target _TestRunStart to mark start of the actual test running, in case we need to do build before
the test running. This is used in MSBuild Terminal Logger to detect that the current project will run some tests.
-->
<Target Name="_VSTestMSBuild" Condition="'$(IsTestProject)' == 'true'">
<CallTarget Condition="!$(VSTestNoBuild)" Targets="BuildProject" />
<CallTarget Targets="_TestRunStart" />
<VSTestTask2
TestFileFullPath="$(TargetPath)"
VSTestSetting="$([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
VSTestTestAdapterPath="$(VSTestTestAdapterPath)"
VSTestFramework="$(TargetFrameworkMoniker)"
VSTestPlatform="$(PlatformTarget)"
VSTestTestCaseFilter="$(VSTestTestCaseFilter)"
VSTestLogger="$(VSTestLogger)"
VSTestListTests="$(VSTestListTests)"
VSTestDiag="$(VSTestDiag)"
VSTestCLIRunSettings="$(VSTestCLIRunSettings)"
VSTestConsolePath="$(VSTestConsolePath)"
VSTestResultsDirectory="$(VSTestResultsDirectory)"
VSTestVerbosity="$(VSTestVerbosity)"
VSTestCollect="$(VSTestCollect)"
VSTestBlame="$(VSTestBlame)"
VSTestBlameCrash="$(VSTestBlameCrash)"
VSTestBlameCrashDumpType="$(VSTestBlameCrashDumpType)"
VSTestBlameCrashCollectAlways="$(VSTestBlameCrashCollectAlways)"
VSTestBlameHang="$(VSTestBlameHang)"
VSTestBlameHangDumpType="$(VSTestBlameHangDumpType)"
VSTestBlameHangTimeout="$(VSTestBlameHangTimeout)"
VSTestTraceDataCollectorDirectoryPath="$(TraceDataCollectorDirectoryPath)"
VSTestArtifactsProcessingMode="$(VSTestArtifactsProcessingMode)"
VSTestSessionCorrelationId="$(VSTestSessionCorrelationId)"
VSTestNoLogo="$(VSTestNoLogo)"
/>
</Target>
<Target Name="_TestRunStart" />
<!-- Used when called from dotnet test command line: does not use MSBuild logs to allow for console colorization -->
<Target Name="_VSTestConsole">
<CallTarget Condition="'$(VSTestNoBuild)' != 'true' AND '$(IsTestProject)' == 'true'" Targets="BuildProject" />
<CallTarget Targets="ShowCallOfVSTestTaskWithParameter" />
<VSTestTask
TestFileFullPath="$(TargetPath)"
VSTestSetting="$([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
VSTestTestAdapterPath="$(VSTestTestAdapterPath)"
VSTestFramework="$(TargetFrameworkMoniker)"
VSTestPlatform="$(PlatformTarget)"
VSTestTestCaseFilter="$(VSTestTestCaseFilter)"
VSTestLogger="$(VSTestLogger)"
VSTestListTests="$(VSTestListTests)"
VSTestDiag="$(VSTestDiag)"
VSTestCLIRunSettings="$(VSTestCLIRunSettings)"
VSTestConsolePath="$(VSTestConsolePath)"
VSTestResultsDirectory="$(VSTestResultsDirectory)"
VSTestVerbosity="$(VSTestVerbosity)"
VSTestCollect="$(VSTestCollect)"
VSTestBlame="$(VSTestBlame)"
VSTestBlameCrash="$(VSTestBlameCrash)"
VSTestBlameCrashDumpType="$(VSTestBlameCrashDumpType)"
VSTestBlameCrashCollectAlways="$(VSTestBlameCrashCollectAlways)"
VSTestBlameHang="$(VSTestBlameHang)"
VSTestBlameHangDumpType="$(VSTestBlameHangDumpType)"
VSTestBlameHangTimeout="$(VSTestBlameHangTimeout)"
VSTestTraceDataCollectorDirectoryPath="$(TraceDataCollectorDirectoryPath)"
VSTestArtifactsProcessingMode="$(VSTestArtifactsProcessingMode)"
VSTestSessionCorrelationId="$(VSTestSessionCorrelationId)"
VSTestNoLogo="$(VSTestNoLogo)"
Condition="'$(IsTestProject)' == 'true'"
/>
</Target>
<Target Name="ShowInfoMessageIfProjectHasNoIsTestProjectProperty" Condition="'$(IsTestProject)' == ''">
<VSTestLogsTask LogType="NoIsTestProjectProperty" ProjectFilePath="$(MSBuildProjectFullPath)" />
</Target>
<Target Name="BuildProject">
<CallTarget Targets="ShowMsbuildWithParameter" />
<VSTestLogsTask LogType="BuildStarted" />
<MSBuild Projects ="$(MSBuildProjectFullPath)" />
<VSTestLogsTask LogType="BuildCompleted" />
<Message Importance="Low" Text="Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" />
</Target>
<Target Name="ShowMsbuildWithParameter">
<Message Importance="Low" Text="Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" />
<Message Importance="Low" Text="Value passed to msbuild are..." />
<Message Importance="Low" Text="Configuration = $(Configuration)" />
<Message Importance="Low" Text="TargetFramework = $(TargetFramework)" />
<Message Importance="Low" Text="Platform = $(PlatformTarget)" />
<Message Importance="Low" Text="OutputPath = $(OutputPath)" />
</Target>
<Target Name="ShowCallOfVSTestTaskWithParameter">
<Message Importance="Low" Text="Calling task Microsoft.TestPlatform.Build.Tasks.VSTestTask with following parameter..." />
<Message Importance="Low" Text="TestFileFullPath = $(TargetPath)" />
<Message Importance="Low" Text="VSTestSetting = $(VSTestSetting)" />
<Message Importance="Low" Text="VSTestTestAdapterPath = $(VSTestTestAdapterPath)" />
<Message Importance="Low" Text="VSTestFramework = $(TargetFrameworkMoniker)" />
<Message Importance="Low" Text="VSTestPlatform = $(PlatformTarget)" />
<Message Importance="Low" Text="VSTestTestCaseFilter = $(VSTestTestCaseFilter)" />
<Message Importance="Low" Text="VSTestLogger = $(VSTestLogger)" />
<Message Importance="Low" Text="VSTestListTests = $(VSTestListTests)" />
<Message Importance="Low" Text="VSTestDiag = $(VSTestDiag)" />
<Message Importance="Low" Text="VSTestCLIRunSettings = $(VSTestCLIRunSettings)" />
<Message Importance="Low" Text="VSTestResultsDirectory = $(VSTestResultsDirectory)" />
<Message Importance="Low" Text="VSTestConsolePath = $(VSTestConsolePath)" />
<Message Importance="Low" Text="VSTestVerbosity = $(VSTestVerbosity)" />
<Message Importance="Low" Text="VSTestCollect = $(VSTestCollect)" />
<Message Importance="Low" Text="VSTestBlame = $(VSTestBlame)" />
<Message Importance="Low" Text="VSTestTraceDataCollectorDirectoryPath = $(TraceDataCollectorDirectoryPath)" />
<Message Importance="Low" Text="VSTestNoLogo = $(VSTestNoLogo)" />
</Target>
</Project>