Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable MTP #37001

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .pipelines/v2/templates/job-build-project.yml
Original file line number Diff line number Diff line change
@@ -146,16 +146,19 @@ jobs:
parameters:
sdk: true
version: '6.0'
platform: $(BuildPlatform)

- template: steps-ensure-dotnet-version.yml
parameters:
sdk: true
version: '8.0'
platform: $(BuildPlatform)

- template: steps-ensure-dotnet-version.yml
parameters:
sdk: true
version: '9.0'
platform: $(BuildPlatform)

- ${{ if eq(parameters.runTests, true) }}:
- task: VisualStudioTestPlatformInstaller@1
22 changes: 4 additions & 18 deletions .pipelines/v2/templates/job-test-project.yml
Original file line number Diff line number Diff line change
@@ -73,9 +73,6 @@ jobs:
sdk: true
version: '9.0'

- task: VisualStudioTestPlatformInstaller@1
displayName: Ensure VSTest Platform

- pwsh: |-
& '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
displayName: Download and install WinAppDriver
@@ -85,18 +82,7 @@ jobs:
inputs:
displaySettings: 'optimal'

- task: VSTest@3
displayName: Run UI Tests
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
searchFolder: '$(Pipeline.Workspace)\build-${{ parameters.platform }}-${{ parameters.configuration }}${{ parameters.inputArtifactStem }}'
vsTestVersion: 'toolsInstaller'
uiTests: true
rerunFailedTests: true
testAssemblyVer2: |
**\UITests-FancyZones.dll
**\UITests-FancyZonesEditor.dll
!**\obj\**
!**\ref\**
- script:
dotnet test $(Build.SourcesDirectory)\src\modules\fancyzones\UITests-FancyZones\UITests-FancyZones.csproj --no-build -c $(BuildConfiguration) -p:Platform=$(BuildPlatform)
dotnet test $(Build.SourcesDirectory)\src\modules\fancyzones\UITests-FancyZonesEditor\UITests-FancyZonesEditor.csproj --no-build -c $(BuildConfiguration) -p:Platform=$(BuildPlatform)
displayName: "Run UI Tests"
4 changes: 3 additions & 1 deletion .pipelines/v2/templates/steps-ensure-dotnet-version.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ parameters:
- name: sdk
type: boolean
default: false
- name: platform
type: string

# You might be wondering, "Why didn't they use UseDotNet?"
# Azure Pipelines is practically unmaintained, that's why.
@@ -21,7 +23,7 @@ steps:
exit 1
}
$NEW_DOTNET_ROOT = "$(Agent.ToolsDirectory)\dotnet"
& ./dotnet-install.ps1 -Channel "${{parameters.version}}" -InstallDir $NEW_DOTNET_ROOT
& ./dotnet-install.ps1 -Channel "${{parameters.version}}" -Architecture ${{parameters.platform}} -InstallDir $NEW_DOTNET_ROOT
Write-Host "##vso[task.setvariable variable=DOTNET_ROOT]${NEW_DOTNET_ROOT}"
Write-Host "##vso[task.prependpath]${NEW_DOTNET_ROOT}"
Remove-Item dotnet-install.ps1 -ErrorAction:Ignore
19 changes: 16 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -17,6 +17,11 @@
<NuGetAuditMode>direct</NuGetAuditMode>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
<PlatformTarget>$(Platform)</PlatformTarget>

<!-- Enable Microsoft.Testing.Platform -->
<EnableMSTestRunner>true</EnableMSTestRunner>
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
<TestingPlatformDotNetTestSupport>true</TestingPlatformDotNetTestSupport>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
@@ -45,7 +50,15 @@
</PackageReference>
</ItemGroup>

<!-- Add ability to run tests via "msbuild /t:Test" -->
<!-- In CI, we build and test with `/t:Build;Test` -->
<!-- So, for non-test projects, we want the target to be there and it's basically doing nothing -->
<!-- For C# test projects, Microsoft.Testing.Platform should inject Test target here: -->
<!-- https://github.com/microsoft/testfx/blob/5ad21909704db501f58f27d4a7ec241edd761af5/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets#L270-L273 -->
<!-- For C++ test projects, the RunVSTest SDK will do its job -->
<Target Name="Test" />

<!-- Add ability to run tests via "msbuild /t:Test" using the RunVSTest SDK -->
<!-- This is only needed for C++, as we use Microsoft.Testing.Platform for C# -->
<!--
Workaround an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
See: https://github.com/dotnet/msbuild/pull/9984
@@ -55,11 +68,11 @@
Once the change referenced above is fixed, the ImportGroup below can be replaced with:
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
-->
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64'">
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64' AND ('$(Language)' == 'C++' OR '$(MSBuildProjectExtension)' == '.vcxproj')">
<Import Project="Sdk.props" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
<Import Project="Sdk.targets" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
</ImportGroup>
<PropertyGroup>
<PropertyGroup Condition="'$(Language)' == 'C++' OR '$(MSBuildProjectExtension)' == '.vcxproj'">
<VSTestLogger>trx</VSTestLogger>
<!--
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
<PackageVersion Include="ModernWpfUI" Version="0.9.4" />
<!-- Moq to stay below v4.20 due to behavior change. need to be sure fixed -->
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="MSTest" Version="3.6.3" />
<PackageVersion Include="MSTest" Version="3.7.3" />
<PackageVersion Include="NLog" Version="5.0.4" />
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageVersion Include="NLog.Schema" Version="5.2.8" />
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@
<RootNamespace>Microsoft.FancyZones.UITests</RootNamespace>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<!-- This is a UI test, so don't run as part of MSBuild -->
<RunVSTest>false</RunVSTest>
<OutputType>Exe</OutputType>

<!-- This is a UI test, so don't run as part of the Test target -->
<TestingPlatformDisableCustomTestTarget>true</TestingPlatformDisableCustomTestTarget>
</PropertyGroup>

<PropertyGroup>
Original file line number Diff line number Diff line change
@@ -15,13 +15,14 @@ namespace UITests_FancyZonesEditor
public class RunFancyZonesEditorTest
{
private static FancyZonesEditorSession? _session;
private static TestContext? _context;
private readonly TestContext _context;

public RunFancyZonesEditorTest(TestContext context)
=> _context = context;

[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
_context = testContext;

// prepare files to launch Editor without errors
EditorParameters editorParameters = new EditorParameters();
EditorParameters.ParamsWrapper parameters = new EditorParameters.ParamsWrapper
@@ -133,19 +134,18 @@ public static void ClassInitialize(TestContext testContext)
public static void ClassCleanup()
{
FancyZonesEditorSession.Files.Restore();
_context = null;
}

[TestInitialize]
public void TestInitialize()
{
_session = new FancyZonesEditorSession(_context!);
_session = new FancyZonesEditorSession(_context);
}

[TestCleanup]
public void TestCleanup()
{
_session?.Close(_context!);
_session?.Close(_context);
}

[TestMethod]
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@
<RootNamespace>Microsoft.FancyZonesEditor.UITests</RootNamespace>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<OutputType>Exe</OutputType>

<!-- This is a UI test, so don't run as part of MSBuild -->
<RunVSTest>false</RunVSTest>
<!-- This is a UI test, so don't run as part of the Test target -->
<TestingPlatformDisableCustomTestTarget>true</TestingPlatformDisableCustomTestTarget>
</PropertyGroup>

<PropertyGroup>