Skip to content

Commit cc76710

Browse files
chore(deps): update microsoft.testing to 1.7.0 (#2416)
* chore(deps): update microsoft.testing to 1.7.0 * Update test artifact logic --------- Co-authored-by: Renovate Bot <[email protected]>
1 parent a861f5a commit cc76710

File tree

6 files changed

+22
-37
lines changed

6 files changed

+22
-37
lines changed

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
<PackageVersion Include="Microsoft.Playwright" Version="1.52.0" />
3737
<PackageVersion Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" Version="9.0.300" />
3838
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
39-
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="1.6.3" />
40-
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="1.6.3" />
41-
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.3" />
42-
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="1.6.3" />
43-
<PackageVersion Include="Microsoft.Testing.Platform" Version="1.6.3" />
39+
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="1.7.0" />
40+
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="1.7.0" />
41+
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.7.0" />
42+
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="1.7.0" />
43+
<PackageVersion Include="Microsoft.Testing.Platform" Version="1.7.0" />
4444
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="1.4.3" />
4545
<PackageVersion Include="ModularPipelines.DotNet" Version="2.44.44" />
4646
<PackageVersion Include="ModularPipelines.Git" Version="2.44.44" />

TUnit.Core/ITUnitMessageBus.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,4 @@ internal interface ITUnitMessageBus
5151
/// </summary>
5252
/// <param name="artifact">The artifact.</param>
5353
ValueTask SessionArtifact(Artifact artifact);
54-
55-
/// <summary>
56-
/// Sends a test artifact message for the specified test context.
57-
/// </summary>
58-
/// <param name="testContext">The test context.</param>
59-
/// <param name="artifact">The artifact.</param>
60-
ValueTask TestArtifact(TestContext testContext, Artifact artifact);
6154
}

TUnit.Engine/Extensions/TestExtensions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ internal static TestNode ToTestNode(this TestContext testContext)
2828
TypeName: testContext.GetClassTypeName(),
2929
MethodName: testDetails.TestName,
3030
ParameterTypeFullNames: testDetails.TestMethodParameterTypes.Select(x => x.FullName!).ToArray(),
31-
ReturnTypeFullName: testDetails.ReturnType.FullName!
31+
ReturnTypeFullName: testDetails.ReturnType.FullName!,
32+
MethodArity: testDetails.TestMethod.GenericTypeCount
3233
),
34+
3335
// Custom TUnit Properties
3436
..testDetails.Categories.Select(category => new TestMetadataProperty(category, string.Empty)),
3537
..testDetails.CustomProperties.Select(x => new TestMetadataProperty(x.Key, x.Value)),
3638

39+
// Artifacts
40+
..testContext.Artifacts.Select(x => new FileArtifactProperty(x.File, x.DisplayName, x.Description)),
41+
3742
// TRX Report Properties
3843
new TrxFullyQualifiedTypeNameProperty(testDetails.TestClass.Type.FullName!),
3944
new TrxCategoriesProperty([..testDetails.Categories]),

TUnit.Engine/Services/HookMessagePublisher.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ public async Task Discover(string sessionId, string displayName, StaticHookMetho
2525
new LinePosition(hookMethod.LineNumber, 0))),
2626
new TestMethodIdentifierProperty
2727
(
28-
hookMethod.Assembly.FullName!, hookMethod.ClassType.Namespace!,
29-
hookMethod.ClassType.Name, hookMethod.Name,
28+
hookMethod.Assembly.FullName!,
29+
hookMethod.ClassType.Namespace!,
30+
hookMethod.ClassType.Name,
31+
hookMethod.Name,
32+
hookMethod.MethodInfo.GenericTypeCount,
3033
hookMethod.MethodInfo.Parameters.Select(x => x.Type.FullName!).ToArray(),
3134
hookMethod.MethodInfo.ReturnType.FullName!
3235
)
@@ -71,8 +74,11 @@ private async Task PublishAsync(string sessionId, string displayName, StaticHook
7174
new TimingProperty(new TimingInfo(start, end, end - start)),
7275
new TestMethodIdentifierProperty
7376
(
74-
hookMethod.Assembly.FullName!, hookMethod.ClassType.Namespace!,
75-
hookMethod.ClassType.Name, hookMethod.Name,
77+
hookMethod.Assembly.FullName!,
78+
hookMethod.ClassType.Namespace!,
79+
hookMethod.ClassType.Name,
80+
hookMethod.Name,
81+
hookMethod.MethodInfo.GenericTypeCount,
7682
hookMethod.MethodInfo.Parameters.Select(x => x.Type.FullName!).ToArray(),
7783
hookMethod.MethodInfo.ReturnType.FullName!
7884
),

TUnit.Engine/Services/SingleTestExecutor.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,6 @@ await RunHelpers.RunValueTaskSafelyAsync(() => testSkippedEventReceiver.OnTestSk
283283

284284
await ExecuteStaticAfterHooks(test, testContext, cleanUpExceptions);
285285

286-
foreach (var artifact in testContext.Artifacts)
287-
{
288-
await messageBus.TestArtifact(testContext, artifact);
289-
}
290-
291286
ExceptionsHelper.ThrowIfAny(cleanUpExceptions);
292287
}
293288
catch (Exception e)
@@ -514,6 +509,5 @@ public Task<bool> IsEnabledAsync()
514509
public Type[] DataTypesProduced { get; } =
515510
[
516511
typeof(TestNodeUpdateMessage),
517-
typeof(TestNodeFileArtifact)
518512
];
519513
}

TUnit.Engine/TUnitMessageBus.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,6 @@ await context.MessageBus.PublishAsync(this,
145145
);
146146
}
147147

148-
public async ValueTask TestArtifact(TestContext testContext, Artifact artifact)
149-
{
150-
await context.MessageBus.PublishAsync(this,
151-
new TestNodeFileArtifact(
152-
context.Request.Session.SessionUid,
153-
testContext.ToTestNode(),
154-
artifact.File,
155-
artifact.DisplayName,
156-
artifact.Description
157-
)
158-
);
159-
}
160-
161148
private static TimingProperty GetTimingProperty(TestContext testContext, DateTimeOffset overallStart)
162149
{
163150
if (overallStart == default)
@@ -227,5 +214,5 @@ public Task<bool> IsEnabledAsync()
227214

228215
public string Description => extension.Description;
229216

230-
public Type[] DataTypesProduced => [typeof(TestNodeUpdateMessage), typeof(SessionFileArtifact), typeof(TestNodeFileArtifact)];
217+
public Type[] DataTypesProduced => [typeof(TestNodeUpdateMessage), typeof(SessionFileArtifact)];
231218
}

0 commit comments

Comments
 (0)