Skip to content

Commit

Permalink
Rename VSTestTask to VSTestForwardingTask (microsoft#680)
Browse files Browse the repository at this point in the history
VSTestForwardingTask redirects the console output instead of using MSBuild logs. Renaming it will allow to create a new VSTestTask that uses the MSBuild log infrastructure.
  • Loading branch information
mcartoixa committed Apr 2, 2023
1 parent 4051959 commit 4479d26
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 87 deletions.
60 changes: 30 additions & 30 deletions src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
<VSTestConsolePath Condition="$(VSTestConsolePath) == ''">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),"vstest.console.dll"))</VSTestConsolePath>
</PropertyGroup>
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
<UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />

<!--
Expand All @@ -29,7 +29,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<CallTarget Targets="ShowCallOfVSTestTaskWithParameter" />

<Microsoft.TestPlatform.Build.Tasks.VSTestTask
<VSTestForwardingTask
TestFileFullPath="$(TargetPath)"
VSTestSetting="$([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
VSTestTestAdapterPath="$(VSTestTestAdapterPath)"
Expand Down Expand Up @@ -60,47 +60,47 @@ Copyright (c) .NET Foundation. All rights reserved.
</Target>

<Target Name="ShowInfoMessageIfProjectHasNoIsTestProjectProperty" Condition="'$(IsTestProject)' == ''">
<Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask LogType="NoIsTestProjectProperty" ProjectFilePath="$(MSBuildProjectFullPath)" />
<VSTestLogsTask LogType="NoIsTestProjectProperty" ProjectFilePath="$(MSBuildProjectFullPath)" />
</Target>

<Target Name="BuildProject">
<CallTarget Targets="ShowMsbuildWithParameter" />

<Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask LogType="BuildStarted" />
<VSTestLogsTask LogType="BuildStarted" />
<MSBuild Projects ="$(MSBuildProjectFullPath)" />
<Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask LogType="BuildCompleted" />
<VSTestLogsTask LogType="BuildCompleted" />

<Message Text="Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance="low" />
<Message Importance="Low" Text="Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" />
</Target>

<Target Name="ShowMsbuildWithParameter">
<Message Text="Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance="low"/>
<Message Text="Value passed to msbuild are..." Importance="low" />
<Message Text="Configuration = $(Configuration)" Importance="low" />
<Message Text="TargetFramework = $(TargetFramework)" Importance="low" />
<Message Text="Platform = $(PlatformTarget)" Importance="low" />
<Message Text="OutputPath = $(OutputPath)" Importance="low" />
<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 Text="Calling task Microsoft.TestPlatform.Build.Tasks.VSTestTask with following parameter..." Importance="low" />
<Message Text="TestFileFullPath = $(TargetPath)" Importance="low" />
<Message Text="VSTestSetting = $(VSTestSetting)" Importance="low" />
<Message Text="VSTestTestAdapterPath = $(VSTestTestAdapterPath)" Importance="low" />
<Message Text="VSTestFramework = $(TargetFrameworkMoniker)" Importance="low" />
<Message Text="VSTestPlatform = $(PlatformTarget)" Importance="low" />
<Message Text="VSTestTestCaseFilter = $(VSTestTestCaseFilter)" Importance="low" />
<Message Text="VSTestLogger = $(VSTestLogger)" Importance="low" />
<Message Text="VSTestListTests = $(VSTestListTests)" Importance="low" />
<Message Text="VSTestDiag = $(VSTestDiag)" Importance="low" />
<Message Text="VSTestCLIRunSettings = $(VSTestCLIRunSettings)" Importance="low" />
<Message Text="VSTestResultsDirectory = $(VSTestResultsDirectory)" Importance="low" />
<Message Text="VSTestConsolePath = $(VSTestConsolePath)" Importance="low" />
<Message Text="VSTestVerbosity = $(VSTestVerbosity)" Importance="low" />
<Message Text="VSTestCollect = $(VSTestCollect)" Importance="low" />
<Message Text="VSTestBlame = $(VSTestBlame)" Importance="low" />
<Message Text="VSTestTraceDataCollectorDirectoryPath = $(TraceDataCollectorDirectoryPath)" Importance="low" />
<Message Text="VSTestNoLogo = $(VSTestNoLogo)" Importance="low" />
<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>
108 changes: 54 additions & 54 deletions src/Microsoft.TestPlatform.Build/PublicAPI/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,63 @@ Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.LogType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.VSTestLogsTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask
Microsoft.TestPlatform.Build.Tasks.VSTestTask.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.get -> string!
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.TestFileFullPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.TestFileFullPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestArtifactsProcessingMode.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestArtifactsProcessingMode.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlame.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlame.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrash.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrash.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrashCollectAlways.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrashCollectAlways.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrashDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameCrashDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHang.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHang.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHangDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHangDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHangTimeout.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestBlameHangTimeout.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestCLIRunSettings.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestCLIRunSettings.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestCollect.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestCollect.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestConsolePath.get -> string!
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestConsolePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestDiag.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestDiag.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestFramework.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestFramework.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestListTests.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestListTests.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestLogger.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestLogger.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestNoLogo.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestNoLogo.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestPlatform.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestPlatform.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestResultsDirectory.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestResultsDirectory.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestSessionCorrelationId.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestSessionCorrelationId.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestSetting.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestSetting.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestForwardingTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTestAdapterPath.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTestAdapterPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTestCaseFilter.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTestCaseFilter.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTraceDataCollectorDirectoryPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestTraceDataCollectorDirectoryPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestVerbosity.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.VSTestVerbosity.set -> void
Microsoft.TestPlatform.Build.Trace.Tracing
Microsoft.TestPlatform.Build.Utils.ArgumentEscaper
override Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.Execute() -> bool
override Microsoft.TestPlatform.Build.Tasks.VSTestTask.Execute() -> bool
override Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask.Execute() -> bool
static Microsoft.TestPlatform.Build.Trace.Tracing.Trace(string! message) -> void
static Microsoft.TestPlatform.Build.Trace.Tracing.traceEnabled -> bool
static Microsoft.TestPlatform.Build.Utils.ArgumentEscaper.HandleEscapeSequenceInArgForProcessStart(string! arg) -> string!
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Microsoft.TestPlatform.Build.Tasks;

public class VSTestTask : Task, ICancelableTask
public class VSTestForwardingTask : Task, ICancelableTask
{
// The process which is invoking vstest.console
private VSTestForwardingApp? _vsTestForwardingApp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ namespace Microsoft.TestPlatform.Build.UnitTests;
[TestClass]
public class VsTestTaskTests
{
private readonly VSTestTask _vsTestTask;
private readonly VSTestForwardingTask _vsTestTask;

public VsTestTaskTests()
{
_vsTestTask = new VSTestTask
_vsTestTask = new VSTestForwardingTask
{
TestFileFullPath = @"C:\path\to\test-assembly.dll",
VSTestFramework = ".NETCoreapp,Version2.0"
Expand Down

0 comments on commit 4479d26

Please sign in to comment.