Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f52cba6
Convert internal framework to MTP
Evangelink Feb 13, 2025
c9e9753
Merge branch 'main' into full-mtp
Evangelink Feb 15, 2025
b10a471
Fix 1 test project
Evangelink Feb 13, 2025
ca974eb
Merge branch 'main' into full-mtp
Evangelink Feb 17, 2025
bea2275
Fix tests
Evangelink Feb 17, 2025
af851a8
Merge branch 'main' into full-mtp
Evangelink Feb 17, 2025
77c9b51
Use var
Evangelink Feb 17, 2025
c093c33
Merge branch 'main' into full-mtp
Evangelink Feb 18, 2025
5680675
Fix
Evangelink Feb 18, 2025
e25aec7
Refactor
Evangelink Feb 19, 2025
94d863b
Merge branch 'main' into full-mtp
Evangelink Feb 19, 2025
68fd05b
Fix using
Evangelink Feb 19, 2025
05a8ba7
Fix stacktrace check under release
Evangelink Feb 19, 2025
f8f5670
Fix
Evangelink Feb 19, 2025
1489842
test
Evangelink Feb 20, 2025
10cc913
Merge branch 'main' into full-mtp
Evangelink Feb 21, 2025
835c3bb
More fixes
Evangelink Feb 21, 2025
4a9d38d
Try to use net6.0
Evangelink Feb 21, 2025
97de971
Revert "Try to use net6.0"
Evangelink Feb 21, 2025
32c83b4
Try to force set DOTNET_ROOT env var for vstest console wrapper
Evangelink Feb 21, 2025
a6739d8
Merge branch 'main' into full-mtp
Evangelink Feb 21, 2025
3059b76
Use net6 instead of netcoreapp3.1
Evangelink Feb 22, 2025
2c87978
Merge branch 'main' into full-mtp
Evangelink Feb 23, 2025
c90f46b
Revert "Use net6 instead of netcoreapp3.1"
Evangelink Feb 23, 2025
8f17142
Mroe
Evangelink Feb 23, 2025
5ead38f
Add netcoreapp3.1 x86
Evangelink Feb 23, 2025
9c0fbbf
Disable tests
Evangelink Feb 23, 2025
aff47ee
Drop using
Evangelink Feb 23, 2025
9766ea0
Again
Evangelink Feb 23, 2025
c4d75d2
Now?
Evangelink Feb 23, 2025
434eca2
Disable more
Evangelink Feb 23, 2025
3235ea8
Fix
Evangelink Feb 23, 2025
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
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Enabled globally, cleaning up the various files.

</PropertyGroup>

<!-- The TFMs to build and test against. -->
Expand Down
7 changes: 1 addition & 6 deletions eng/TestingPlatformRunner/TestingPlatformRunner.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<Project>
<Import Project="$(NuGetPackageRoot)\microsoft.dotnet.arcade.sdk\$(ArcadeSdkVersion)\tools\VSTest.targets" Condition=" '$(UseVSTestRunner)' == 'true' "/>
<Import Project=".\TestingPlatform.Runner.targets" Condition=" '$(UseVSTestRunner)' != 'true' " />

<PropertyGroup>
<TestRunnerAdditionalArguments Condition=" '$(UseVSTestRunner)' == 'true' ">--blame-crash --blame-crash-dump-type full</TestRunnerAdditionalArguments>
</PropertyGroup>
<Import Project=".\TestingPlatform.Runner.targets" />
</Project>
7 changes: 4 additions & 3 deletions samples/FxExtensibility/AssertEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MSTest.Extensibility.Samples;
[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "This is only some sample type")]
public static class AssertEx
{
private static AssertIs s_assertIs;
private static AssertIs? s_assertIs;

/// <summary>
/// A simple assert extension to validate if an object is of a given type.
Expand All @@ -22,13 +22,14 @@ public static class AssertEx
/// <returns>True if object is of the given type.</returns>
/// <exception cref="AssertFailedException">If object is not of the given type.</exception>
#pragma warning disable IDE0060 // Remove unused parameter
public static bool IsOfType<T>(this Assert assert, object obj) => obj is T
public static bool IsOfType<T>(this Assert assert, object obj)
=> obj is T
? true
: throw new AssertFailedException(string.Format(
CultureInfo.InvariantCulture,
"Expected object of type {0} but found object of type {1}",
typeof(T),
obj ?? obj.GetType()));
obj ?? obj?.GetType()));

/// <summary>
/// A chain/grouping of assert statements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ This package provides the core platform and the .NET implementation of the proto
<InternalsVisibleTo Include="MSTest.Acceptance.IntegrationTests" Key="$(VsPublicKey)" />
<InternalsVisibleTo Include="MSTest.Engine" Key="$(VsPublicKey)" />
<InternalsVisibleTo Include="MSTest.Engine.UnitTests" Key="$(VsPublicKey)" />
<InternalsVisibleTo Include="TestFramework.ForTestingMSTest" Key="$(VsPublicKey)" />
<InternalsVisibleTo Include="MSTest.IntegrationTests" Key="$(VsPublicKey)" />
Comment on lines +60 to +61

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Needed for polyfill

</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

<PropertyGroup>
<TestRunnerName>TestingPlatformRunner</TestRunnerName>
<!-- By default we run tests with VSTest runner and custom test framework. Platform projects will use a different runner and framework -->
<UseVSTestRunner Condition=" '$(UseVSTestRunner)' == '' " >true</UseVSTestRunner>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Build & pack tests -->
Expand Down
23 changes: 12 additions & 11 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

<Import Project="../Directory.Build.targets" />

<PropertyGroup Condition=" '$(UseVSTestRunner)' == 'false' ">
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<EnableMSTestRunner>true</EnableMSTestRunner>
<PropertyGroup Condition=" '$(EnableMSTestRunner)' == 'true' OR '$(UseInternalTestFramework)' == 'true' ">
<UseMSTest Condition=" '$(UseMSTest)' == '' ">true</UseMSTest>
<GenerateProgramFile>false</GenerateProgramFile>
<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>
<Architecture Condition=" '$(Architecture)' == '' ">$(PlatformTarget)</Architecture>
Expand All @@ -21,29 +19,32 @@
<!-- /Arcade runner settings -->
</PropertyGroup>

<ItemGroup Condition=" '$(UseVSTestRunner)' == 'false' ">
<ProjectReference Include="$(RepoRoot)test\Utilities\Microsoft.Testing.TestInfrastructure\Microsoft.Testing.TestInfrastructure.csproj" />
<ItemGroup Condition=" '$(EnableMSTestRunner)' == 'true' OR '$(UseInternalTestFramework)' == 'true' ">
<ProjectReference Include="$(RepoRoot)test\Utilities\Microsoft.Testing.TestInfrastructure\Microsoft.Testing.TestInfrastructure.csproj"
Condition="'$(UseInternalTestFramework)' != 'true'" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.CrashDump\Microsoft.Testing.Extensions.CrashDump.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.HangDump\Microsoft.Testing.Extensions.HangDump.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.Retry\Microsoft.Testing.Extensions.Retry.csproj" />
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Extensions.TrxReport\Microsoft.Testing.Extensions.TrxReport.csproj" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" GeneratePathProperty="True" />
</ItemGroup>

<ItemGroup Condition=" '$(UseVSTestRunner)' == 'false' AND '$(UseMSTestFromSource)' != 'true' ">
<ItemGroup Condition=" '$(EnableMSTestRunner)' == 'true' AND '$(UseInternalTestFramework)' != 'true' AND '$(UseMSTestFromSource)' != 'true' ">
<PackageReference Include="MSTest.Analyzers" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.TestAdapter" />
</ItemGroup>

<ItemGroup Condition=" '$(UseVSTestRunner)' == 'false' ">
<ItemGroup Condition=" '$(EnableMSTestRunner)' == 'true' OR '$(UseInternalTestFramework)' == 'true' ">
<Using Include="Microsoft.Testing.Platform.Builder" />
<Using Include="Microsoft.Testing.Platform.Extensions" />
<Using Include="Microsoft.Testing.TestInfrastructure" />
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
<Using Include="Microsoft.Testing.TestInfrastructure"
Condition="'$(UseInternalTestFramework)' != 'true'" />
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting"
Condition="'$(UseMSTest)' == 'true'" />
</ItemGroup>

<ItemGroup Condition=" '$(UseVSTestRunner)' == 'false' ">
<ItemGroup Condition=" '$(EnableMSTestRunner)' == 'true' OR '$(UseInternalTestFramework)' == 'true' ">
<None Update="*.testconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCurrent)</TargetFrameworks>
<UseVSTestRunner>false</UseVSTestRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<DefineConstants Condition=" '$(FastAcceptanceTest)' == 'true'">$(DefineConstants);SKIP_INTERMEDIATE_TARGET_FRAMEWORKS</DefineConstants>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
<DefineConstants Condition=" '$(FastAcceptanceTest)' == 'true'">$(DefineConstants);SKIP_INTERMEDIATE_TARGET_FRAMEWORKS</DefineConstants>
<UseAppHost>true</UseAppHost>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;

using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult;

namespace MSTest.IntegrationTests;

public static class VerifyE2E
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetFrameworkMinimum)</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn),1685</NoWarn>
<UseInternalTestFramework>true</UseInternalTestFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions test/IntegrationTests/MSTest.IntegrationTests/OutputTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.MSTestV2.CLIAutomation;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;

using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult;

namespace MSTest.IntegrationTests;

public class OutputTests : CLITestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.MSTestV2.CLIAutomation;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;

using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult;

namespace MSTest.IntegrationTests;

public class DataExtensibilityTests : CLITestBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.MSTestV2.CLIAutomation;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;

using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult;

namespace MSTest.IntegrationTests;

public class DynamicDataTests : CLITestBase
Expand Down
21 changes: 21 additions & 0 deletions test/IntegrationTests/MSTest.IntegrationTests/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Testing.Extensions;

using TestFramework.ForTestingMSTest;

ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args);

#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddTrxReportProvider();
builder.AddHangDumpProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddRetryProvider();

builder.AddInternalTestFramework();

ITestApplication app = await builder.BuildAsync();
return await app.RunAsync();
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

using TestFramework.ForTestingMSTest;

using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult;

namespace Microsoft.MSTestV2.CLIAutomation;

public partial class CLITestBase : TestContainer
Expand Down Expand Up @@ -90,7 +92,7 @@ private sealed class InternalFrameworkHandle : IFrameworkHandle
private readonly List<string> _messageList = [];
private readonly ConcurrentDictionary<TestCase, ConcurrentBag<TestResult>> _testResults = new();

private ConcurrentBag<TestResult> _activeResults = null!;
private ConcurrentBag<TestResult> _activeResults = new();

public bool EnableShutdownAfterTestRun { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public TestFilterExpression(string filter, Func<Func<string, object?>, bool> exp

public string TestCaseFilterValue { get; }

public bool MatchTestCase(TestCase testCase, Func<string, object?> propertyValueProvider) => _expression(propertyValueProvider);
public bool MatchTestCase(TestCase testCase, Func<string, object?> propertyValueProvider)
=> _expression(propertyValueProvider);
}

private static void MergeExpression(Stack<Expression<Func<Func<string, object?>, bool>>> exp, Operator op)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetFrameworkMinimum)</TargetFramework>
<UseInternalTestFramework>true</UseInternalTestFramework>
<UseMSTest>false</UseMSTest>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Testing.Extensions;

using TestFramework.ForTestingMSTest;

ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args);

#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddTrxReportProvider();
builder.AddHangDumpProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddRetryProvider();

builder.AddInternalTestFramework();

ITestApplication app = await builder.BuildAsync();
return await app.RunAsync();
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
<PropertyGroup>
<TargetFrameworks>$(NetCurrent)</TargetFrameworks>
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --retry-failed-tests 3</TestRunnerAdditionalArguments>
<UseVSTestRunner>false</UseVSTestRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<DefineConstants Condition=" '$(FastAcceptanceTest)' == 'true'">$(DefineConstants);SKIP_INTERMEDIATE_TARGET_FRAMEWORKS</DefineConstants>
<OutputType>Exe</OutputType>
<DefineConstants Condition=" '$(FastAcceptanceTest)' == 'true'">$(DefineConstants);SKIP_INTERMEDIATE_TARGET_FRAMEWORKS</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetFrameworkMinimum)</TargetFramework>
<UseInternalTestFramework>true</UseInternalTestFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Testing.Extensions;

using TestFramework.ForTestingMSTest;

ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args);

#if ENABLE_CODECOVERAGE
builder.AddCodeCoverageProvider();
#endif
builder.AddTrxReportProvider();
builder.AddHangDumpProvider();
builder.AddCrashDumpProvider(ignoreIfNotSupported: true);
builder.AddRetryProvider();

builder.AddInternalTestFramework();

ITestApplication app = await builder.BuildAsync();
return await app.RunAsync();
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using FluentAssertions;

using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using SampleFrameworkExtensions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<UseVSTestRunner>false</UseVSTestRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>

<!-- Analyzers project need to explicitly exclude compile and runtime assets from MSTest.TestFramework NuGet package -->
<!-- This is to ensure that the assembly built from source is what is being used in tests -->
<!-- This will exclude compile and runtime assets from NuGet so that they flow via ProjectReference -->
<UseMSTestFromSource>true</UseMSTestFromSource>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net462</TargetFrameworks>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(MicrosoftTestingTargetFrameworks);net462</TargetFrameworks>
<RootNamespace>Microsoft.Testing.Framework.UnitTests</RootNamespace>
<NoMoq>true</NoMoq>
<NoFluentAssertions>true</NoFluentAssertions>
<UseVSTestRunner>false</UseVSTestRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<RootNamespace>Microsoft.Testing.Framework.UnitTests</RootNamespace>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"MSTest.Engine.UnitTests": {
"commandName": "Project",
"commandLineArgs": "--treenode-filter /*/*/*/**",
"commandLineArgs": "",
"environmentVariables": {
//"TESTINGPLATFORM_HOTRELOAD_ENABLED": "1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<PropertyGroup>
<!-- Analyzers testing tools don't yet support tfms over net6.0 -->
<TargetFrameworks>net6.0</TargetFrameworks>
<RootNamespace>Microsoft.Testing.Framework.SourceGeneration.UnitTests</RootNamespace>
<NoWarn>$(NoWarn);NU1701</NoWarn>
<UseVSTestRunner>false</UseVSTestRunner>
<EnableMSTestRunner>true</EnableMSTestRunner>
<RootNamespace>Microsoft.Testing.Framework.SourceGeneration.UnitTests</RootNamespace>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"MSTest.SourceGeneration.UnitTests": {
"commandName": "Project",
"commandLineArgs": "--treenode-filter /*/*/*/**"
"commandLineArgs": ""
}
}
}
Loading