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

Added constants for hierarchical naming #2724

Merged
merged 1 commit into from
Feb 1, 2021
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
7 changes: 3 additions & 4 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ function Publish-Package
$fullCLRPackage451Dir = Get-FullCLRPackageDirectory
$fullCLRPackage45Dir = Get-FullCLRPackageDirectory45
$uap100PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkUap100");
$net20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net20");
$net35PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net35");
$net45PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net45");
$netstandard10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS10");
$netstandard13PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS13");
$netstandard20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS20");
Expand Down Expand Up @@ -485,8 +484,8 @@ function Publish-Package
# Publish Microsoft.TestPlatform.AdapterUtilities
Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.AdapterUtilities\bin\$TPB_Configuration") `
-files @{
# "net20" = $net20PackageDir # net20 \ net20, and net35 isn't supported by the Test Platform
# "net35" = $net35PackageDir # net35 / but this package supports, so adding targets.
# "net20" = $net20PackageDir # net20
"net45/any" = $net45PackageDir # $net4
$TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0
$TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0
$TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Verify-Nuget-Packages($packageDirectory, $version)
"Microsoft.TestPlatform.CLI" = 381;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 35;
"Microsoft.TestPlatform.ObjectModel" = 180;
"Microsoft.TestPlatform.AdapterUtilities" = 48;
"Microsoft.TestPlatform.AdapterUtilities" = 62;
"Microsoft.TestPlatform.Portable" = 570;
"Microsoft.TestPlatform.TestHost" = 214;
"Microsoft.TestPlatform.TranslationLayer" = 123;
Expand Down
52 changes: 52 additions & 0 deletions src/Microsoft.TestPlatform.AdapterUtilities/HierarchyConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.TestPlatform.AdapterUtilities
{
/// <summary>
/// Constants to help declare Hierarchy test property.
/// </summary>
public static class HierarchyConstants
Haplois marked this conversation as resolved.
Show resolved Hide resolved
{
/// <summary>
/// Label to use on Hierarchy test property.
/// </summary>
public const string HierarchyLabel = "Hierarchy";

/// <summary>
/// Property id to use on Hierarchy test property.
/// </summary>
public const string HierarchyPropertyId = "TestCase." + HierarchyLabel;

/// <summary>
/// Meanings of the indices in the Hierarchy array.
/// </summary>
public static class Levels
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the HierarchyName property be a dictionary instead, so both setting/retrieving is easier to understand and uniqueness of values is guaranteed? We could serialize/deserialise this the way we want internally,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like a <string, string> directory with set keys on the adapter?

Copy link
Contributor

@AbhitejJohn AbhitejJohn Apr 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh, I dont have a good way of responding to notifications from github. Yes, I meant a <string,string> property bag.
/cc : @Haplois

{
/// <summary>
/// Total length of Hierarchy array.
/// </summary>
public const int TotalLevelCount = 4;

/// <summary>
/// Index of the namespace element of the array.
/// </summary>
public const int NamespaceIndex = 0;

/// <summary>
/// Index of the class element of the array.
/// </summary>
public const int ClassIndex = 1;

/// <summary>
/// Index of the test group element of the array.
/// </summary>
public const int TestGroupIndex = 2;

/// <summary>
/// Index of the display name element of the array.
/// </summary>
public const int DisplayNameIndex = 3;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.TestPlatform.AdapterUtilities
{
/// <summary>
/// Contants to help declare ManagedType and ManagedMethod test properties.
/// </summary>
public static class ManagedNameConstants
{
/// <summary>
/// Label to use on ManagedType test property.
/// </summary>
public const string ManagedTypeLabel = "ManagedType";

/// <summary>
/// Label to use on ManagedMethod test property.
/// </summary>
public const string ManagedMethodLabel = "ManagedMethod";

/// <summary>
/// Property id to use on ManagedType test property.
/// </summary>
public const string ManagedTypePropertyId = "TestCase." + ManagedTypeLabel;

/// <summary>
/// Property id to use on ManagedMethod test property.
/// </summary>
public const string ManagedMethodPropertyId = "TestCase." + ManagedMethodLabel;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />

<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);uap10.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>

Expand All @@ -28,6 +28,11 @@
<TargetFrameworkVersion Condition="'$(OS)' != 'Windows_NT'">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<RuntimeIdentifier>any</RuntimeIdentifier>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="5.1.0" />
</ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions src/package/nuspec/Microsoft.TestPlatform.AdapterUtilities.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,30 @@

<dependencies>
<group targetFramework="netstandard1.0">
<dependency id="NETStandard.Library" version="[1.6.1, )" />
<dependency id="System.Globalization" version="[4.0.11, )" />
<dependency id="System.Reflection" version="[4.1.0, )" />
<dependency id="System.Runtime" version="[4.1.0, )" />
<dependency id="System.Collections" version="[4.0.11, )" />
<dependency id="System.Diagnostics.Debug" version="[4.0.11, )" />
<dependency id="System.Linq" version="[4.1.0, )" />
<dependency id="System.Reflection.Extensions" version="[4.1.0, )" />
<dependency id="System.Resources.ResourceManager" version="[4.0.1, )" />
</group>

<group targetFramework="netstandard2.0">
<dependency id="NETStandard.Library" version="[1.6.1, )" />
</group>
<group targetFramework="netstandard2.0" />

<group targetFramework="uap10.0">
<dependency id="Microsoft.NETCore.UniversalWindowsPlatform" version="[5.1.0, )" />
</group>

<group targetFramework="net45" />
</dependencies>
</metadata>

<files>
<file src="Icon.png" target="" />
<file src="licenses\LICENSE_NET.txt" target="" />

<file src="netstandard1.0\Microsoft.TestPlatform.AdapterUtilities.dll" target="lib\netstandard1.0" />
<file src="netstandard1.0\**\Microsoft.TestPlatform.AdapterUtilities.resources.dll" target="lib\netstandard1.0" />

Expand All @@ -47,5 +55,8 @@

<file src="uap10.0\Microsoft.TestPlatform.AdapterUtilities.dll" target="lib\uap10.0" />
<file src="uap10.0\**\Microsoft.TestPlatform.AdapterUtilities.resources.dll" target="lib\uap10.0" />

<file src="net45\Microsoft.TestPlatform.AdapterUtilities.dll" target="lib\net45" />
<file src="net45\**\Microsoft.TestPlatform.AdapterUtilities.resources.dll" target="lib\net45" />
</files>
</package>