Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ filegroup(
":crashdump",
":ctrf",
":framework",
":framework_extensions",
":framework_compatibility",
":github_report",
":globalconfigs_generator",
":hangdump",
Expand Down Expand Up @@ -179,7 +179,6 @@ testfx_binary(
":adapter",
":ctrf",
":framework",
":framework_extensions",
":html",
":junit",
":trx",
Expand Down Expand Up @@ -210,7 +209,6 @@ testfx_binary(
deps = [
":assert_generator",
":framework",
":framework_extensions",
":internal_test_framework",
":trx",
"@paket.source//awesomeassertions",
Expand Down
4 changes: 3 additions & 1 deletion MSTest.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"src\\Package\\MSTest\\MSTest.csproj",
"src\\Platform\\Microsoft.Testing.Extensions.PackagedApp.Controller\\Microsoft.Testing.Extensions.PackagedApp.Controller.csproj",
"src\\Platform\\Microsoft.Testing.Extensions.PackagedApp.MSBuild\\Microsoft.Testing.Extensions.PackagedApp.MSBuild.csproj",
"src\\TestFramework\\TestFramework.Extensions\\TestFramework.Extensions.csproj",
"src\\TestFramework\\MSTest.Uwp\\MSTest.Uwp.csproj",
"src\\TestFramework\\MSTest.WinUI\\MSTest.WinUI.csproj",
"src\\TestFramework\\TestFramework.Compatibility\\TestFramework.Compatibility.csproj",
"src\\TestFramework\\TestFramework.Windows.UIAutomation\\TestFramework.Windows.UIAutomation.csproj",
"src\\TestFramework\\TestFramework.SourceGeneration\\TestFramework.SourceGeneration.csproj",
"src\\TestFramework\\TestFramework\\TestFramework.csproj",
Expand Down
2 changes: 1 addition & 1 deletion NonWindowsTests.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"src\\Platform\\Microsoft.Testing.Platform.MSBuild\\Microsoft.Testing.Platform.MSBuild.csproj",
"src\\Platform\\Microsoft.Testing.Platform.ServerMode.Client.Sources\\Microsoft.Testing.Platform.ServerMode.Client.Sources.csproj",
"src\\Platform\\Microsoft.Testing.Platform\\Microsoft.Testing.Platform.csproj",
"src\\TestFramework\\TestFramework.Extensions\\TestFramework.Extensions.csproj",
"src\\TestFramework\\TestFramework.Compatibility\\TestFramework.Compatibility.csproj",
"src\\TestFramework\\TestFramework.Windows.UIAutomation\\TestFramework.Windows.UIAutomation.csproj",
"src\\TestFramework\\TestFramework.SourceGeneration\\TestFramework.SourceGeneration.csproj",
"src\\TestFramework\\TestFramework\\TestFramework.csproj",
Expand Down
4 changes: 3 additions & 1 deletion TestFx.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
<Project Path="src/Adapter/MSTestAdapter.PlatformServices/MSTestAdapter.PlatformServices.csproj" />
</Folder>
<Folder Name="/src/3 - TestFramework/">
<Project Path="src/TestFramework/TestFramework.Extensions/TestFramework.Extensions.csproj" />
<Project Path="src/TestFramework/MSTest.Uwp/MSTest.Uwp.csproj" />
<Project Path="src/TestFramework/MSTest.WinUI/MSTest.WinUI.csproj" />
<Project Path="src/TestFramework/TestFramework.Compatibility/TestFramework.Compatibility.csproj" />
<Project Path="src/TestFramework/TestFramework.Windows.UIAutomation/TestFramework.Windows.UIAutomation.csproj" />
<Project Path="src/TestFramework/TestFramework/TestFramework.csproj" />
<Project Path="src/TestFramework/TestFramework.SourceGeneration/TestFramework.SourceGeneration.csproj" />
Expand Down
380 changes: 380 additions & 0 deletions docs/decisions/explicit-mstest-packages.md

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions docs/winui-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A packaged WinUI 3 desktop app is full trust by default. Packaging gives it iden

`Microsoft.Testing.Extensions.PackagedApp` supports both full-trust and AppContainer hosts end to end. `Microsoft.Testing.Extensions.PackagedApp.MSBuild` supplies the full-trust sidecar controller, selects the packaged test executable explicitly, and ships the UAP-compatible bootstrap. `MSTest.Sdk` references that integration package automatically; the adapter supplies classic UWP's runtime assets.

### Explicit metapackage or adapter integration
### Explicit UI-package integration

Projects using `Microsoft.NET.Sdk` or `MSBuild.Sdk.Extras` instead of `MSTest.Sdk`
can reference the same integration package explicitly:
Expand All @@ -35,13 +35,16 @@ can reference the same integration package explicitly:
<EnableMicrosoftTestingExtensionsTrxReport>true</EnableMicrosoftTestingExtensionsTrxReport>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest" Version="4.5.0" />
<PackageReference Include="Microsoft.Testing.Extensions.PackagedApp.MSBuild" Version="2.5.0" />
<PackageReference Include="MSTest.WinUI" Version="5.0.0" />
<PackageReference Include="Microsoft.Testing.Extensions.PackagedApp.MSBuild" Version="3.0.0" />
</ItemGroup>
```

The `MSTest` reference can be replaced with explicit `MSTest.TestAdapter` and
`MSTest.TestFramework` references. Preserve the application's WinUI/UWP build
For UWP, replace `MSTest.WinUI` with `MSTest.Uwp`. These MSTest 5 packages own the
UI attributes and matching adapter/services and depend on the exact matching
`MSTest.TestFramework` version. Do not combine them with `MSTest.TestAdapter`
or the modern `MSTest` metapackage; classic UAP metapackage consumers select
`MSTest.Uwp` through their UAP dependency group. Preserve the application's WinUI/UWP build
settings and `OnLaunched` bootstrap, then execute
`msbuild MyTests.csproj -t:InvokeTestingPlatform`. Desktop MSBuild and
`dotnet msbuild` both reuse `InvokeTestingPlatformTask` to launch the controller
Expand Down
10 changes: 7 additions & 3 deletions eng/bazel/SdkPackageTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ static Dependency[] MetaPackageDependencies(XElement project, Dictionary<string,
{
var projectDependencies = new Dictionary<string, (string id, string version, string condition)>(StringComparer.Ordinal)
{
["$(RepoRoot)src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj"] = ("MSTest.TestAdapter", versions["MSTestVersion"], ""),
["$(RepoRoot)src/TestFramework/TestFramework.Extensions/TestFramework.Extensions.csproj"] = ("MSTest.TestFramework", versions["MSTestVersion"], ""),
["$(RepoRoot)src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj"] = ("MSTest.TestAdapter", versions["MSTestVersion"], "'$(TargetFramework)'!='$(UwpMinimum)'"),
["$(RepoRoot)src/TestFramework/MSTest.Uwp/MSTest.Uwp.csproj"] = ("MSTest.Uwp", versions["MSTestVersion"], "'$(TargetFramework)'=='$(UwpMinimum)'"),
["$(RepoRoot)src/TestFramework/TestFramework/TestFramework.csproj"] = ("MSTest.TestFramework", versions["MSTestVersion"], ""),
["$(RepoRoot)src/Platform/Microsoft.Testing.Extensions.TrxReport/Microsoft.Testing.Extensions.TrxReport.csproj"] = ("Microsoft.Testing.Extensions.TrxReport", versions["MicrosoftTestingPlatformVersion"], "'$(TargetFramework)'!='$(UwpMinimum)'"),
};
var dependencies = new List<Dependency>();
Expand All @@ -207,7 +208,10 @@ static Dependency[] MetaPackageDependencies(XElement project, Dictionary<string,
throw new InvalidDataException($"Unsupported meta-package project reference or condition: {path}");
}

dependencies.Add(new(dependency.id, dependency.version, ["Build", "Analyzers"]));
if (dependency.condition != "'$(TargetFramework)'=='$(UwpMinimum)'")
{
dependencies.Add(new(dependency.id, dependency.version, ["Build", "Analyzers"]));
}
}

if (projectDependencies.Count != 0)
Expand Down
4 changes: 2 additions & 2 deletions eng/bazel/compatibility.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _PROJECTS = {
"crashdump",
"ctrf",
"framework",
"framework_extensions",
"framework_compatibility",
"github_report",
"hangdump",
"hosting",
Expand All @@ -36,7 +36,7 @@ _PROJECTS = {
"net462": [
"adapter",
"framework",
"framework_extensions",
"framework_compatibility",
"mstest_hosting",
"platform_services",
],
Expand Down
2 changes: 1 addition & 1 deletion eng/bazel/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def extension_libraries():
"src/Adapter/MSTest.Extensions.Hosting/Resources/HostingResources.resx": "Microsoft.VisualStudio.TestTools.UnitTesting.Hosting.Resources.HostingResources",
},
internals_visible_to = ["Microsoft.Testing.Extensions.UnitTests", "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests"],
deps = [":adapter", ":hosting", ":framework", ":framework_extensions"] + testfx_nuget(["microsoft.extensions.dependencyinjection.abstractions"], compatibility_group = "compatibility_hosting") + select({
deps = [":adapter", ":hosting", ":framework"] + testfx_nuget(["microsoft.extensions.dependencyinjection.abstractions"], compatibility_group = "compatibility_hosting") + select({
"//eng/bazel/compatibility:net462": [":netframework_netstandard_facade", ":netframework_runtime_information"],
"//conditions:default": [],
}),
Expand Down
10 changes: 4 additions & 6 deletions eng/bazel/mstest-packages.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,12 @@ def _asset(files, name, source, destination):
def native_mstest_packages():
"""Declare portable packages using the explicit compatibility task wrappers."""
package_version(name = "mstest_package_version", property_name = "VersionPrefix")
framework_project = "src/TestFramework/TestFramework.Extensions"
framework_project = "src/TestFramework/TestFramework"
adapter_project = "src/Adapter/MSTest.TestAdapter"
framework_files = {}
framework_files = {framework_project + "/MSTest.TestFramework.targets": "buildTransitive/MSTest.TestFramework.targets"}
adapter_files = {}
for framework in PORTABLE_FRAMEWORKS:
suffix = framework.replace(".", "_")
_asset(framework_files, "framework_build_" + suffix, framework_project + "/build/" + framework + "/MSTest.TestFramework.targets", "build/" + framework + "/MSTest.TestFramework.targets")
_asset(framework_files, "framework_transitive_" + suffix, framework_project + "/buildTransitive/net10.0AndLater/MSTest.TestFramework.targets", "buildTransitive/" + framework + "/MSTest.TestFramework.targets")
for extension in ["props", "targets"]:
filename = "MSTest.TestAdapter." + extension
_asset(adapter_files, "adapter_build_" + suffix + "_" + extension, adapter_project + "/build/" + framework + "/" + filename, "build/" + framework + "/" + filename)
Expand All @@ -213,8 +211,8 @@ def native_mstest_packages():
version_file = ":mstest_package_version",
description = "Provides the libraries for writing tests with MSTest. MSTest is Microsoft supported Test Framework.",
readme = framework_project + "/PACKAGE.md",
libraries = [":framework", ":framework_extensions"],
directories = ["lib/{tfm}", "buildTransitive/{tfm}"],
libraries = [":framework", ":framework_compatibility"],
directories = ["lib/{tfm}", "lib/{tfm}"],
resource_directories = ["lib/{tfm}", ""],
files = framework_files,
deps = [":analyzers_package"],
Expand Down
21 changes: 4 additions & 17 deletions eng/bazel/mstest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def mstest_libraries():
"MSTestAdapter.PlatformServices",
"MSTest.TestAdapter",
"Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests",
"MSTest.TestFramework.Extensions",
"MSTest.Extensions.Hosting",
"Microsoft.VisualStudio.TestPlatform.TestFramework.UnitTests",
"MSTestAdapter.PlatformServices.UnitTests",
Expand All @@ -47,22 +46,11 @@ def mstest_libraries():
deps = [":assert_generator_plugin"],
)
testfx_library(
name = "framework_extensions",
project = "src/TestFramework/TestFramework.Extensions",
name = "framework_compatibility",
project = "src/TestFramework/TestFramework.Compatibility",
target_frameworks = STANDARD_FRAMEWORKS + ["net462"],
linked_srcs = testfx_compatibility_select(["//eng/bazel:CompatibilityFrameworkMetadata.cs"]),
assembly_name = "MSTest.TestFramework.Extensions",
defines = ["EXCLUDE_RANGE_INDEX_POLYFILL", "EXCLUDE_OS_POLYFILL"],
usings = ["Polyfills", "Microsoft.VisualStudio.TestTools.UnitTesting.Resources"],
resources = {
"src/TestFramework/TestFramework.Extensions/Resources/FrameworkExtensionsMessages.resx": "Microsoft.VisualStudio.TestTools.UnitTesting.Resources.FrameworkExtensionsMessages",
},
internals_visible_to = [
"MSTestAdapter.PlatformServices",
"MSTestAdapter.PlatformServices.UnitTests",
"MSTest.TestAdapter",
"Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests",
],
polyfills = False,
deps = [":framework"],
)
testfx_library(
Expand All @@ -84,7 +72,7 @@ def mstest_libraries():
"MSTest.Acceptance.IntegrationTests",
"MSTest.Performance.Benchmarks",
],
deps = [":framework", ":framework_extensions"] + testfx_compatibility_select([
deps = [":framework"] + testfx_compatibility_select([
"@paket.compatibility_mstest//system.memory",
"@paket.compatibility_mstest//system.threading.tasks.extensions",
]) + select({
Expand Down Expand Up @@ -131,7 +119,6 @@ def mstest_libraries():
":msbuild_extension",
":retry",
":platform_msbuild",
":framework_extensions",
] + testfx_nuget(["microsoft.testplatform.objectmodel"], compatibility_group = "compatibility_mstest") + testfx_compatibility_select([
"@paket.compatibility_mstest//system.memory",
"@paket.compatibility_mstest//system.threading.tasks.extensions",
Expand Down
1 change: 0 additions & 1 deletion eng/bazel/reference-alias-tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def reference_alias_tests():
":alias_second",
":adapter",
":framework",
":framework_extensions",
":trx",
],
)
Expand Down
6 changes: 3 additions & 3 deletions eng/bazel/samples.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def portable_samples():
linked_srcs = ["//eng/bazel:TestMain.cs", "//eng/bazel:PortableTestFrameworkMetadata.cs"],
defines = defines,
generate_documentation_file = False,
deps = [":adapter", ":framework", ":framework_extensions", ":trx"],
deps = [":adapter", ":framework", ":trx"],
)
testfx_test(
name = name + "_test",
Expand All @@ -37,7 +37,7 @@ def portable_samples():
polyfills = False,
usings = ["Microsoft.VisualStudio.TestTools.UnitTesting"],
generate_documentation_file = False,
deps = [":adapter", ":framework", ":framework_extensions", ":platform"],
deps = [":adapter", ":framework", ":platform"],
)
testfx_test(
name = "custom_report_test",
Expand Down Expand Up @@ -152,7 +152,7 @@ def portable_samples():
linked_srcs = ["//eng/bazel:TestMain.cs", "//eng/bazel:PortableTestFrameworkMetadata.cs"],
analyzer_configs = ["//eng/bazel:reflection-free.globalconfig"],
generate_documentation_file = False,
deps = [":adapter", ":framework", ":framework_extensions", ":platform_services", ":trx", ":sample_source_generator"],
deps = [":adapter", ":framework", ":platform_services", ":trx", ":sample_source_generator"],
)
# The pinned rules_dotnet links NativeAOT only for Linux and macOS; it fails analysis for Windows.
native_aot_hosts = select({
Expand Down
2 changes: 1 addition & 1 deletion eng/bazel/sdk-packages.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def sdk_packages():
generate_documentation_file = False,
data = ["//eng/bazel:sdk_package_tool"],
envs = {"TESTFX_BAZEL_SDK_PACKAGE_TOOL": "$(rlocationpath //eng/bazel:sdk_package_tool)"},
deps = [":adapter", ":framework", ":framework_extensions", ":trx", ":mstest_analyzer_plugin", "//eng/bazel:runfiles"],
deps = [":adapter", ":framework", ":trx", ":mstest_analyzer_plugin", "//eng/bazel:runfiles"],
)
testfx_test(
name = "sdk_package_tests",
Expand Down
6 changes: 2 additions & 4 deletions eng/bazel/tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def native_unit_test_deps():
":platform",
":adapter",
":framework",
":framework_extensions",
":trx",
":junit",
":ctrf",
Expand Down Expand Up @@ -185,7 +184,7 @@ def unit_tests():
defines = ["TESTFX_FOUR_WORKERS" if four_workers else "TESTFX_METHOD_PARALLEL"],
usings = ["Microsoft.Testing.Platform.Extensions"] if name == "vstest_bridge_tests" else [],
generate_documentation_file = False,
deps = [":platform", ":adapter", ":framework", ":framework_extensions", ":trx", ":mstest_analyzer_plugin"] + dependencies,
deps = [":platform", ":adapter", ":framework", ":trx", ":mstest_analyzer_plugin"] + dependencies,
)
testfx_test(
name = name,
Expand All @@ -203,7 +202,7 @@ def unit_tests():
generate_documentation_file = False,
data = ["//eng/bazel:build_tools"],
envs = {"TESTFX_BAZEL_BUILD_TOOLS": "$(rlocationpath //eng/bazel:build_tools)"},
deps = [":adapter", ":framework", ":framework_extensions", ":trx", ":mstest_analyzer_plugin", "//eng/bazel:runfiles"],
deps = [":adapter", ":framework", ":trx", ":mstest_analyzer_plugin", "//eng/bazel:runfiles"],
)
testfx_test(
name = "build_tools_tests",
Expand Down Expand Up @@ -231,7 +230,6 @@ def unit_tests():
generate_documentation_file = False,
deps = [
":framework",
":framework_extensions",
":adapter",
":platform_services",
":platform",
Expand Down
13 changes: 6 additions & 7 deletions eng/bazel/validate-mstest-packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ function Assert-PackageLayout($Archive, $Metadata, [string] $Id) {
foreach ($framework in $frameworks) {
switch ($Id) {
'MSTest.TestFramework' {
foreach ($extension in @('dll', 'xml', 'pdb')) {
$null = Get-ZipHash $Archive "lib/$framework/MSTest.TestFramework.$extension"
$null = Get-ZipHash $Archive "buildTransitive/$framework/MSTest.TestFramework.Extensions.$extension"
foreach ($name in @('MSTest.TestFramework', 'MSTest.TestFramework.Extensions')) {
foreach ($extension in @('dll', 'xml', 'pdb')) {
$null = Get-ZipHash $Archive "lib/$framework/$name.$extension"
}
}
if ($Archive.GetEntry("lib/$framework/MSTest.TestFramework.Extensions.dll")) { throw 'Framework.Extensions must not be an implicit lib asset for modern .NET.' }
$null = Get-ZipHash $Archive "build/$framework/MSTest.TestFramework.targets"
$null = Get-ZipHash $Archive "buildTransitive/$framework/MSTest.TestFramework.targets"
$null = Get-ZipHash $Archive 'buildTransitive/MSTest.TestFramework.targets'
}
'MSTest.TestAdapter' {
foreach ($name in @('MSTest.TestAdapter', 'MSTestAdapter.PlatformServices')) {
Expand Down Expand Up @@ -196,7 +195,7 @@ function New-Expectations([string] $Framework, [string] $Path) {
$archive = [System.IO.Compression.ZipFile]::OpenRead($packages[$id].Path)
try {
$names = switch ($id) {
'MSTest.TestFramework' { @("lib/$Framework/MSTest.TestFramework.dll", "buildTransitive/$Framework/MSTest.TestFramework.Extensions.dll") }
'MSTest.TestFramework' { @("lib/$Framework/MSTest.TestFramework.dll", "lib/$Framework/MSTest.TestFramework.Extensions.dll") }
'MSTest.TestAdapter' { @("buildTransitive/$Framework/MSTest.TestAdapter.dll", "buildTransitive/$Framework/MSTestAdapter.PlatformServices.dll") }
'Microsoft.Testing.Platform.MSBuild' { @("lib/$Framework/Microsoft.Testing.Extensions.MSBuild.dll") }
default { @("lib/$Framework/$id.dll") }
Expand Down
Loading
Loading