Skip to content

Commit fc2be35

Browse files
authored
[Test Optimization] MsTest support updates (#7663)
## Summary of changes - Extend the MSTest package matrix (generator definitions, props, and generated test enumerations) to track new 4.x releases and keep the integration samples in sync. - Update the MSTest V2 calltarget instrumentation to support the async ExecuteAsync path introduced in MSTest 4.x, including new duck-typed interfaces, retry-state handling, and regenerated instrumentation metadata/calltarget tables. - Refresh the sample MSTest test projects to default to 4.x, add async test method attribute overrides, and enable additional CI diagnostics for the corresponding integration tests. ## Reason for change - MSTest 4.x introduced asynchronous execution APIs that bypassed our existing instrumentation and were not yet part of the supported version set; without these updates we miss spans/metadata for customers adopting the new framework. ## Implementation details - Bumped the MSTest package version ranges (up to <5.0.0) and added explicit 4.x entries across generator inputs, props, and generated C# enumerations used by the integration test harness. - Introduced new duck-typing interfaces for MSTest 4.x, split the calltarget implementation to share logic between Execute and ExecuteAsync, and regenerated instrumentation/calltarget metadata files to cover the new methods. - Adjusted the sample MSTest projects and tests (conditional compilation with MSTEST_ASYNC, async overrides, environment configuration) so the integration suite exercises the new async pipeline. ## Test coverage - Current tests now runs on the new versions. ## Other details
1 parent 0270676 commit fc2be35

File tree

31 files changed

+2053
-835
lines changed

31 files changed

+2053
-835
lines changed

tracer/build/PackageVersionsGeneratorDefinitions.json

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -613,36 +613,51 @@
613613
"SampleProjectName": "Samples.MSTestTests",
614614
"NugetPackageSearchName": "MSTest.TestFramework",
615615
"MinVersion": "2.0.0",
616-
"MaxVersionExclusive": "3.10.5",
616+
"MaxVersionExclusive": "5.0.0",
617617
"SpecificVersions": [
618618
"2.0.*",
619619
"2.*.*",
620-
"3.*.*"
621-
]
620+
"3.*.*",
621+
"4.*.*"
622+
],
623+
"VersionConditions": [{
624+
"MinVersion": "4.0.0",
625+
"ExcludeTargetFrameworks": ["netcoreapp2.1", "netcoreapp3.0", "netcoreapp3.1", "net5.0", "net6.0", "net7.0"]
626+
}]
622627
},
623628
{
624629
"IntegrationName": "MSTest2",
625630
"SampleProjectName": "Samples.MSTestTests2",
626631
"NugetPackageSearchName": "MSTest.TestFramework",
627632
"MinVersion": "2.0.0",
628-
"MaxVersionExclusive": "3.10.5",
633+
"MaxVersionExclusive": "5.0.0",
629634
"SpecificVersions": [
630635
"2.0.*",
631636
"2.*.*",
632-
"3.*.*"
633-
]
637+
"3.*.*",
638+
"4.*.*"
639+
],
640+
"VersionConditions": [{
641+
"MinVersion": "4.0.0",
642+
"ExcludeTargetFrameworks": ["netcoreapp2.1", "netcoreapp3.0", "netcoreapp3.1", "net5.0", "net6.0", "net7.0"]
643+
}]
634644
},
635645
{
636646
"IntegrationName": "MSTest2Retries",
637647
"SampleProjectName": "Samples.MSTestTestsRetries",
638648
"NugetPackageSearchName": "MSTest.TestFramework",
639649
"MinVersion": "2.0.0",
640-
"MaxVersionExclusive": "3.10.5",
650+
"MaxVersionExclusive": "5.0.0",
641651
"SpecificVersions": [
642652
"2.0.*",
643653
"2.*.*",
644-
"3.*.*"
645-
]
654+
"3.*.*",
655+
"4.*.*"
656+
],
657+
"VersionConditions": [{
658+
"MinVersion": "4.0.0",
659+
"ExcludeTargetFrameworks": ["netcoreapp2.1", "netcoreapp3.0", "netcoreapp3.1", "net5.0", "net6.0", "net7.0"]
660+
}]
646661
},
647662
{
648663
"IntegrationName": "Kafka",

tracer/build/PackageVersionsLatestMajors.g.props

Lines changed: 102 additions & 30 deletions
Large diffs are not rendered by default.

tracer/build/PackageVersionsLatestMinors.g.props

Lines changed: 354 additions & 30 deletions
Large diffs are not rendered by default.

tracer/build/PackageVersionsLatestSpecific.g.props

Lines changed: 102 additions & 30 deletions
Large diffs are not rendered by default.

tracer/build/_build/Honeypot/IntegrationGroups.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ static IntegrationMap()
119119
NugetPackages.Add("Microsoft.TestPlatform.PlatformAbstractions", Array.Empty<string>());
120120
NugetPackages.Add("Microsoft.VisualStudio.TraceDataCollector", Array.Empty<string>());
121121
NugetPackages.Add("Microsoft.TestPlatform.CrossPlatEngine", Array.Empty<string>());
122+
NugetPackages.Add("MSTest.TestFramework", Array.Empty<string>());
123+
NugetPackages.Add("MSTestAdapter.PlatformServices", Array.Empty<string>());
122124
NugetPackages.Add("RestSharp", Array.Empty<string>());
123125

124126
// Manual instrumentation

tracer/build/supported_calltargets.g.json

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10753,6 +10753,30 @@
1075310753
"IsAdoNetIntegration": false,
1075410754
"InstrumentationCategory": 1
1075510755
},
10756+
{
10757+
"IntegrationName": "MsTestV2",
10758+
"AssemblyName": "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices",
10759+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo",
10760+
"TargetMethodName": "ExecuteClassCleanupAsync",
10761+
"TargetReturnType": "_",
10762+
"TargetParameterTypes": [
10763+
"_"
10764+
],
10765+
"MinimumVersion": {
10766+
"Item1": 14,
10767+
"Item2": 0,
10768+
"Item3": 0
10769+
},
10770+
"MaximumVersion": {
10771+
"Item1": 14,
10772+
"Item2": 65535,
10773+
"Item3": 65535
10774+
},
10775+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestClassInfoExecuteClassCleanupAsyncIntegration",
10776+
"IntegrationKind": 0,
10777+
"IsAdoNetIntegration": false,
10778+
"InstrumentationCategory": 1
10779+
},
1075610780
{
1075710781
"IntegrationName": "MsTestV2",
1075810782
"AssemblyName": "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices",
@@ -10826,6 +10850,30 @@
1082610850
"IsAdoNetIntegration": false,
1082710851
"InstrumentationCategory": 1
1082810852
},
10853+
{
10854+
"IntegrationName": "MsTestV2",
10855+
"AssemblyName": "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices",
10856+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo",
10857+
"TargetMethodName": "RunClassInitializeAsync",
10858+
"TargetReturnType": "System.Threading.Tasks.Task",
10859+
"TargetParameterTypes": [
10860+
"_"
10861+
],
10862+
"MinimumVersion": {
10863+
"Item1": 14,
10864+
"Item2": 0,
10865+
"Item3": 0
10866+
},
10867+
"MaximumVersion": {
10868+
"Item1": 14,
10869+
"Item2": 65535,
10870+
"Item3": 65535
10871+
},
10872+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestClassInfoRunClassInitializeAsyncIntegration",
10873+
"IntegrationKind": 0,
10874+
"IsAdoNetIntegration": false,
10875+
"InstrumentationCategory": 1
10876+
},
1082910877
{
1083010878
"IntegrationName": "MsTestV2",
1083110879
"AssemblyName": "Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices",
@@ -11124,6 +11172,254 @@
1112411172
"IsAdoNetIntegration": false,
1112511173
"InstrumentationCategory": 1
1112611174
},
11175+
{
11176+
"IntegrationName": "MsTestV2",
11177+
"AssemblyName": "MSTest.TestFramework",
11178+
"TargetTypeName": "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute",
11179+
"TargetMethodName": "ExecuteAsync",
11180+
"TargetReturnType": "System.Threading.Tasks.Task`1[Microsoft.VisualStudio.TestTools.UnitTesting.TestResult[]]",
11181+
"TargetParameterTypes": [
11182+
"Microsoft.VisualStudio.TestTools.UnitTesting.ITestMethod"
11183+
],
11184+
"MinimumVersion": {
11185+
"Item1": 4,
11186+
"Item2": 0,
11187+
"Item3": 0
11188+
},
11189+
"MaximumVersion": {
11190+
"Item1": 4,
11191+
"Item2": 65535,
11192+
"Item3": 65535
11193+
},
11194+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestMethodAttributeExecuteAsyncIntegration",
11195+
"IntegrationKind": 0,
11196+
"IsAdoNetIntegration": false,
11197+
"InstrumentationCategory": 1
11198+
},
11199+
{
11200+
"IntegrationName": "MsTestV2",
11201+
"AssemblyName": "MSTest.TestFramework",
11202+
"TargetTypeName": "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute",
11203+
"TargetMethodName": "ExecuteAsync",
11204+
"TargetReturnType": "System.Threading.Tasks.Task`1[Microsoft.VisualStudio.TestTools.UnitTesting.TestResult[]]",
11205+
"TargetParameterTypes": [
11206+
"Microsoft.VisualStudio.TestTools.UnitTesting.ITestMethod"
11207+
],
11208+
"MinimumVersion": {
11209+
"Item1": 4,
11210+
"Item2": 0,
11211+
"Item3": 0
11212+
},
11213+
"MaximumVersion": {
11214+
"Item1": 4,
11215+
"Item2": 65535,
11216+
"Item3": 65535
11217+
},
11218+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestMethodAttributeExecuteAsyncIntegration",
11219+
"IntegrationKind": 1,
11220+
"IsAdoNetIntegration": false,
11221+
"InstrumentationCategory": 1
11222+
},
11223+
{
11224+
"IntegrationName": "MsTestV2",
11225+
"AssemblyName": "MSTestAdapter.PlatformServices",
11226+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestAssemblyInfo",
11227+
"TargetMethodName": "RunAssemblyInitialize",
11228+
"TargetReturnType": "System.Void",
11229+
"TargetParameterTypes": [
11230+
"Microsoft.VisualStudio.TestTools.UnitTesting.TestContext"
11231+
],
11232+
"MinimumVersion": {
11233+
"Item1": 4,
11234+
"Item2": 0,
11235+
"Item3": 0
11236+
},
11237+
"MaximumVersion": {
11238+
"Item1": 4,
11239+
"Item2": 65535,
11240+
"Item3": 65535
11241+
},
11242+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestAssemblyInfoRunAssemblyInitializeIntegration",
11243+
"IntegrationKind": 0,
11244+
"IsAdoNetIntegration": false,
11245+
"InstrumentationCategory": 1
11246+
},
11247+
{
11248+
"IntegrationName": "MsTestV2",
11249+
"AssemblyName": "MSTestAdapter.PlatformServices",
11250+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo",
11251+
"TargetMethodName": "ExecuteClassCleanupAsync",
11252+
"TargetReturnType": "_",
11253+
"TargetParameterTypes": [
11254+
"_"
11255+
],
11256+
"MinimumVersion": {
11257+
"Item1": 4,
11258+
"Item2": 0,
11259+
"Item3": 0
11260+
},
11261+
"MaximumVersion": {
11262+
"Item1": 4,
11263+
"Item2": 65535,
11264+
"Item3": 65535
11265+
},
11266+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestClassInfoExecuteClassCleanupAsyncIntegration",
11267+
"IntegrationKind": 0,
11268+
"IsAdoNetIntegration": false,
11269+
"InstrumentationCategory": 1
11270+
},
11271+
{
11272+
"IntegrationName": "MsTestV2",
11273+
"AssemblyName": "MSTestAdapter.PlatformServices",
11274+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo",
11275+
"TargetMethodName": "RunClassInitializeAsync",
11276+
"TargetReturnType": "System.Threading.Tasks.Task",
11277+
"TargetParameterTypes": [
11278+
"_"
11279+
],
11280+
"MinimumVersion": {
11281+
"Item1": 4,
11282+
"Item2": 0,
11283+
"Item3": 0
11284+
},
11285+
"MaximumVersion": {
11286+
"Item1": 4,
11287+
"Item2": 65535,
11288+
"Item3": 65535
11289+
},
11290+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestClassInfoRunClassInitializeAsyncIntegration",
11291+
"IntegrationKind": 0,
11292+
"IsAdoNetIntegration": false,
11293+
"InstrumentationCategory": 1
11294+
},
11295+
{
11296+
"IntegrationName": "MsTestV2",
11297+
"AssemblyName": "MSTestAdapter.PlatformServices",
11298+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodRunner",
11299+
"TargetMethodName": "ExecuteTestAsync",
11300+
"TargetReturnType": "System.Threading.Tasks.Task`1[Microsoft.VisualStudio.TestTools.UnitTesting.TestResult[]]",
11301+
"TargetParameterTypes": [
11302+
"Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo"
11303+
],
11304+
"MinimumVersion": {
11305+
"Item1": 4,
11306+
"Item2": 0,
11307+
"Item3": 0
11308+
},
11309+
"MaximumVersion": {
11310+
"Item1": 4,
11311+
"Item2": 65535,
11312+
"Item3": 65535
11313+
},
11314+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TestMethodRunnerExecuteTestIntegrationV3_9",
11315+
"IntegrationKind": 0,
11316+
"IsAdoNetIntegration": false,
11317+
"InstrumentationCategory": 1
11318+
},
11319+
{
11320+
"IntegrationName": "MsTestV2",
11321+
"AssemblyName": "MSTestAdapter.PlatformServices",
11322+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TypeCache",
11323+
"TargetMethodName": "GetTestMethodInfo",
11324+
"TargetReturnType": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo",
11325+
"TargetParameterTypes": [
11326+
"Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod",
11327+
"Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.ITestContext"
11328+
],
11329+
"MinimumVersion": {
11330+
"Item1": 4,
11331+
"Item2": 0,
11332+
"Item3": 0
11333+
},
11334+
"MaximumVersion": {
11335+
"Item1": 4,
11336+
"Item2": 65535,
11337+
"Item3": 65535
11338+
},
11339+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.TypeCacheGetTestMethodInfoIntegrationV3_9",
11340+
"IntegrationKind": 0,
11341+
"IsAdoNetIntegration": false,
11342+
"InstrumentationCategory": 1
11343+
},
11344+
{
11345+
"IntegrationName": "MsTestV2",
11346+
"AssemblyName": "MSTestAdapter.PlatformServices",
11347+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner",
11348+
"TargetMethodName": "RunSingleTest",
11349+
"TargetReturnType": "Microsoft.VisualStudio.TestTools.UnitTesting.TestResult[]",
11350+
"TargetParameterTypes": [
11351+
"Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod",
11352+
"System.Collections.Generic.IDictionary`2[System.String,System.Object]",
11353+
"Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.IMessageLogger"
11354+
],
11355+
"MinimumVersion": {
11356+
"Item1": 4,
11357+
"Item2": 0,
11358+
"Item3": 0
11359+
},
11360+
"MaximumVersion": {
11361+
"Item1": 4,
11362+
"Item2": 65535,
11363+
"Item3": 65535
11364+
},
11365+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.UnitTestRunnerRunSingleTestIntegration3_8",
11366+
"IntegrationKind": 0,
11367+
"IsAdoNetIntegration": false,
11368+
"InstrumentationCategory": 1
11369+
},
11370+
{
11371+
"IntegrationName": "MsTestV2",
11372+
"AssemblyName": "MSTestAdapter.PlatformServices",
11373+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner",
11374+
"TargetMethodName": "RunSingleTestAsync",
11375+
"TargetReturnType": "System.Threading.Tasks.Task`1[Microsoft.VisualStudio.TestTools.UnitTesting.TestResult[]]",
11376+
"TargetParameterTypes": [
11377+
"Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod",
11378+
"System.Collections.Generic.IDictionary`2[System.String,System.Object]",
11379+
"Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.IMessageLogger"
11380+
],
11381+
"MinimumVersion": {
11382+
"Item1": 4,
11383+
"Item2": 0,
11384+
"Item3": 0
11385+
},
11386+
"MaximumVersion": {
11387+
"Item1": 4,
11388+
"Item2": 65535,
11389+
"Item3": 65535
11390+
},
11391+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.UnitTestRunnerRunSingleTestAsyncIntegration3_8",
11392+
"IntegrationKind": 0,
11393+
"IsAdoNetIntegration": false,
11394+
"InstrumentationCategory": 1
11395+
},
11396+
{
11397+
"IntegrationName": "MsTestV2",
11398+
"AssemblyName": "MSTestAdapter.PlatformServices",
11399+
"TargetTypeName": "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.UnitTestDiscoverer",
11400+
"TargetMethodName": "SendTestCases",
11401+
"TargetReturnType": "System.Void",
11402+
"TargetParameterTypes": [
11403+
"System.Collections.Generic.IEnumerable`1[Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.UnitTestElement]",
11404+
"Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestCaseDiscoverySink",
11405+
"Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IDiscoveryContext",
11406+
"Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.IMessageLogger"
11407+
],
11408+
"MinimumVersion": {
11409+
"Item1": 4,
11410+
"Item2": 0,
11411+
"Item3": 0
11412+
},
11413+
"MaximumVersion": {
11414+
"Item1": 4,
11415+
"Item2": 65535,
11416+
"Item3": 65535
11417+
},
11418+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Testing.MsTestV2.UnitTestDiscovererSendTestCasesIntegrationV4",
11419+
"IntegrationKind": 0,
11420+
"IsAdoNetIntegration": false,
11421+
"InstrumentationCategory": 1
11422+
},
1112711423
{
1112811424
"IntegrationName": "MySql",
1112911425
"AssemblyName": "MySql.Data",

tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
</assembly>
116116
<assembly fullname="MongoDB.Driver" />
117117
<assembly fullname="MongoDB.Driver.Core" />
118+
<assembly fullname="MSTest.TestFramework" />
119+
<assembly fullname="MSTestAdapter.PlatformServices" />
118120
<assembly fullname="MySql.Data" />
119121
<assembly fullname="MySqlConnector" />
120122
<assembly fullname="netstandard" />

0 commit comments

Comments
 (0)