Skip to content
Merged
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
2 changes: 1 addition & 1 deletion eng/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Confirm-NugetPackages {
$expectedNumOfFiles = @{
"MSTest.Sdk" = 16
"MSTest.TestFramework" = 105
"MSTest.TestAdapter" = 76
"MSTest.TestAdapter" = 66
"MSTest.Extensions.Hosting" = 57
"MSTest" = 10
"MSTest.Analyzers" = 56
Expand Down
23 changes: 8 additions & 15 deletions src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ $(CommonProductDescription)]]></PackageDescription>
<!-- Curated package dependencies. PrivateAssets="none" so all assets (including build/buildTransitive
targets, e.g. from Microsoft.Testing.Platform.MSBuild) flow to consumers. -->
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport.Abstractions\Microsoft.Testing.Extensions.TrxReport.Abstractions.csproj" PrivateAssets="none" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj" PrivateAssets="all" />
<!-- The classic UWP bootstrap registers TRX and Retry directly, so their runtime dependencies must
flow through NuGet for that TFM instead of being bundled in the adapter package. -->
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj" PrivateAssets="all">
<PrivateAssets Condition=" '$(TargetFramework)' == '$(UwpMinimum)' ">none</PrivateAssets>
Comment thread
Evangelink marked this conversation as resolved.
Resolved
</ProjectReference>
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Telemetry\Microsoft.Testing.Extensions.Telemetry.csproj" PrivateAssets="none" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.MSBuild\Microsoft.Testing.Extensions.MSBuild.csproj" PrivateAssets="all" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Retry\Microsoft.Testing.Extensions.Retry.csproj" PrivateAssets="all" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Retry\Microsoft.Testing.Extensions.Retry.csproj" PrivateAssets="all">
<PrivateAssets Condition=" '$(TargetFramework)' == '$(UwpMinimum)' ">none</PrivateAssets>
</ProjectReference>
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform.MSBuild\Microsoft.Testing.Platform.MSBuild.csproj" PrivateAssets="none" />
<!-- On Windows the package depends on MSTest.TestFramework, matching the historical MSTest.TestAdapter.nuspec.
The historical MSTest.TestAdapter.NonWindows.nuspec did NOT declare this dependency, so on non-Windows builds
Expand Down Expand Up @@ -202,19 +208,6 @@ $(CommonProductDescription)]]></PackageDescription>
<TfmSpecificPackageFile Include="$(TargetDir)MSTest.TestAdapter.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Include="$(TargetDir)MSTestAdapter.PlatformServices.dll" PackagePath="$(_BuildTransitiveDir)" />

<!-- Classic UWP's VSTest deployment only includes adapter dependencies declared by this package's targets.
Bundle the direct dependencies introduced by the native MTP integration so the adapter remains loadable. -->
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Platform.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Extensions.TrxReport.Abstractions.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Extensions.TrxReport.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.ApplicationInsights.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Extensions.MSBuild.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Extensions.Retry.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.Testing.Extensions.Telemetry.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.TestPlatform.CoreUtilities.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.TestPlatform.PlatformAbstractions.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(UwpMinimum)' " Include="$(TargetDir)Microsoft.VisualStudio.TestPlatform.ObjectModel.dll" PackagePath="$(_BuildTransitiveDir)" />

<!-- .NET Framework also bundles the TestFramework assemblies. -->
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(NetFrameworkMinimum)' " Include="$(TargetDir)MSTest.TestFramework.dll" PackagePath="$(_BuildTransitiveDir)" />
<TfmSpecificPackageFile Condition=" '$(TargetFramework)' == '$(NetFrameworkMinimum)' " Include="$(TargetDir)MSTest.TestFramework.Extensions.dll" PackagePath="$(_BuildTransitiveDir)" />
Expand Down
8 changes: 8 additions & 0 deletions src/Adapter/MSTest.TestAdapter/PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Supported platforms:
- UWP 10.0.16299
- UWP 10.0.17763 with .NET 10+

## Classic UWP dependencies

The classic UWP adapter payload contains the adapter and its platform-services
assembly. Microsoft.Testing.Platform and its extensions are restored from their
own NuGet packages rather than duplicated inside this package. The classic UWP
bootstrap also depends on the TRX reporting and Retry packages. The adapter's
build targets include the resolved runtime assemblies in the AppX deployment.

## F# modules

F# modules can contain test functions without a `[<TestClass>]` attribute:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,29 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Extensions.TrxReport.Abstractions.dll"
Link="Microsoft.Testing.Extensions.TrxReport.Abstractions.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Extensions.TrxReport.dll"
Link="Microsoft.Testing.Extensions.TrxReport.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Platform.dll"
Link="Microsoft.Testing.Platform.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.ApplicationInsights.dll"
Link="Microsoft.ApplicationInsights.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Extensions.MSBuild.dll"
Link="Microsoft.Testing.Extensions.MSBuild.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Extensions.Retry.dll"
Link="Microsoft.Testing.Extensions.Retry.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.Testing.Extensions.Telemetry.dll"
Link="Microsoft.Testing.Extensions.Telemetry.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.TestPlatform.CoreUtilities.dll"
Link="Microsoft.TestPlatform.CoreUtilities.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.TestPlatform.PlatformAbstractions.dll"
Link="Microsoft.TestPlatform.PlatformAbstractions.dll"
CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(MSBuildThisFileDirectory)Microsoft.VisualStudio.TestPlatform.ObjectModel.dll"
Link="Microsoft.VisualStudio.TestPlatform.ObjectModel.dll"
CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<!-- SDK-style UWP disables copying NuGet runtime assets by default. Deploy the adapter's
resolved dependencies as AppX content without duplicating them in this package.
Non-SDK UWP projects expose their package assemblies through ReferencePath. -->
<Target Name="_AddMSTestUwpRuntimeDependencies" AfterTargets="ResolveReferences">
<ItemGroup>
<_MSTestUwpRuntimeDependency Include="@(RuntimeCopyLocalItems)" Condition=" '$(UsingMicrosoftNETSdk)' == 'true' " />
<_MSTestUwpRuntimeDependency Include="@(ReferencePath)" Condition=" '$(UsingMicrosoftNETSdk)' != 'true' " />
<Content Include="@(_MSTestUwpRuntimeDependency)"
Condition=" '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.ApplicationInsights'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Extensions.MSBuild'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Extensions.Retry'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Extensions.Telemetry'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Extensions.TrxReport.Abstractions'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Extensions.TrxReport'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.Testing.Platform'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.TestPlatform.CoreUtilities'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.TestPlatform.PlatformAbstractions'
OR '%(_MSTestUwpRuntimeDependency.Filename)' == 'Microsoft.VisualStudio.TestPlatform.ObjectModel' ">
<Link>%(_MSTestUwpRuntimeDependency.Filename)%(_MSTestUwpRuntimeDependency.Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Comment thread
Evangelink marked this conversation as resolved.
Resolved
</ItemGroup>
</Target>

<ItemGroup>
<CompilerVisibleProperty Include="IsMSTestTestAdapterReferenced" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,25 @@ private static void AssertClassicUwpPackageLayout(UwpBuildResult build, string e
(string?)identity.Attribute("Name"),
$"Unexpected package identity in the tooling-generated manifest '{manifestPath}'.");

string retryExtensionPath = Path.Combine(build.PackageLayoutPath, "Microsoft.Testing.Extensions.Retry.dll");
Assert.IsTrue(
File.Exists(retryExtensionPath),
$"The classic UWP package layout does not contain the Retry runtime asset '{retryExtensionPath}'. " +
string[] runtimeAssemblies =
[
"Microsoft.ApplicationInsights.dll",
"Microsoft.Testing.Extensions.MSBuild.dll",
"Microsoft.Testing.Extensions.Retry.dll",
"Microsoft.Testing.Extensions.Telemetry.dll",
"Microsoft.Testing.Extensions.TrxReport.Abstractions.dll",
"Microsoft.Testing.Extensions.TrxReport.dll",
"Microsoft.Testing.Platform.dll",
"Microsoft.TestPlatform.CoreUtilities.dll",
"Microsoft.TestPlatform.PlatformAbstractions.dll",
"Microsoft.VisualStudio.TestPlatform.ObjectModel.dll",
];
string[] missing = runtimeAssemblies
.Where(assembly => !File.Exists(Path.Combine(build.PackageLayoutPath, assembly)))
.ToArray();
Assert.IsEmpty(
missing,
$"The classic UWP package layout is missing runtime dependencies: {string.Join(", ", missing)}. " +
$"Recipe: '{build.RecipePath}'. Binlog: '{build.BinlogPath}'.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ public void PackedMSTestTestFramework_SealsConcreteUIAttributes(string assemblyP
// Classic UWP.
"build/uap10.0/MSTest.TestAdapter.props",
"build/uap10.0/MSTest.TestAdapter.targets",
"buildTransitive/uap10.0/Microsoft.Testing.Extensions.TrxReport.Abstractions.dll",
"buildTransitive/uap10.0/Microsoft.Testing.Extensions.Retry.dll",
"buildTransitive/uap10.0/Microsoft.Testing.Platform.dll",
"buildTransitive/uap10.0/MSTest.TestAdapter.dll",
"buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll",
"buildTransitive/uap10.0/MSTest.TestAdapter.props",
Expand Down Expand Up @@ -243,6 +240,49 @@ public void PackedMSTestTestAdapter_ContainsRequiredWindowsApplicationModelAsset
GetExactCurrentPackagePath("MSTest.TestAdapter"),
RequiredTestAdapterEntries);

[TestMethod]
[OSCondition(OperatingSystems.Windows, IgnoreMessage = "Classic UWP package assets are produced only by Windows packs.")]
public void PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependencies()
{
using ZipArchive archive = ZipFile.OpenRead(GetExactCurrentPackagePath("MSTest.TestAdapter"));
string[] assemblies = archive.Entries
.Select(entry => entry.FullName)
.Where(path => path.StartsWith("buildTransitive/uap10.0/", StringComparison.Ordinal)
&& path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
.Order(StringComparer.Ordinal)
.ToArray();

Assert.AreSequenceEqual(
[
"buildTransitive/uap10.0/MSTest.TestAdapter.dll",
"buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll",
],
assemblies);
}

[TestMethod]
[DataRow("Microsoft.Testing.Extensions.TrxReport")]
[DataRow("Microsoft.Testing.Extensions.Retry")]
[OSCondition(OperatingSystems.Windows, IgnoreMessage = "Classic UWP package assets are produced only by Windows packs.")]
public void PackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependencies(string packageId)
{
using ZipArchive archive = ZipFile.OpenRead(GetExactCurrentPackagePath("MSTest.TestAdapter"));
using var reader = new StreamReader(archive.GetEntry("MSTest.TestAdapter.nuspec")!.Open());
var nuspec = XDocument.Parse(reader.ReadToEnd());
XElement[] groups = nuspec.Descendants().Where(element => element.Name.LocalName == "group").ToArray();
XElement classicGroup = groups.Single(group => (string?)group.Attribute("targetFramework") == "UAP10.0.16299");
XElement dependency = Assert.ContainsSingle(
classicGroup.Elements().Where(element => (string?)element.Attribute("id") == packageId));

Assert.AreEqual(AcceptanceTestBase.MicrosoftTestingPlatformVersion, (string?)dependency.Attribute("version"));
Assert.IsEmpty(
groups.Where(group => group != classicGroup)
.SelectMany(group => group.Elements())
.Where(element => (string?)element.Attribute("id") == packageId)
.ToArray(),
$"The classic UWP bootstrap must not add '{packageId}' to other frameworks.");
}

[TestMethod]
[OSCondition(OperatingSystems.Windows, IgnoreMessage = "Windows application-model package assets are produced only by Windows packs.")]
public void PackedMSTestTestAdapter_UwpPropsRegisterMSTestBuilderHook()
Expand Down
Loading