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
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
<PackageVersion Include="Microsoft.Playwright" Version="1.52.0" />
<PackageVersion Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" Version="9.0.300" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="1.6.3" />
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="1.6.3" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.3" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="1.6.3" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="1.6.3" />
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="1.7.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="1.7.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.7.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="1.7.0" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="1.7.0" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="1.4.3" />
<PackageVersion Include="ModularPipelines.DotNet" Version="2.44.44" />
<PackageVersion Include="ModularPipelines.Git" Version="2.44.44" />
Expand Down
7 changes: 0 additions & 7 deletions TUnit.Core/ITUnitMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,4 @@ internal interface ITUnitMessageBus
/// </summary>
/// <param name="artifact">The artifact.</param>
ValueTask SessionArtifact(Artifact artifact);

/// <summary>
/// Sends a test artifact message for the specified test context.
/// </summary>
/// <param name="testContext">The test context.</param>
/// <param name="artifact">The artifact.</param>
ValueTask TestArtifact(TestContext testContext, Artifact artifact);
}
7 changes: 6 additions & 1 deletion TUnit.Engine/Extensions/TestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ internal static TestNode ToTestNode(this TestContext testContext)
TypeName: testContext.GetClassTypeName(),
MethodName: testDetails.TestName,
ParameterTypeFullNames: testDetails.TestMethodParameterTypes.Select(x => x.FullName!).ToArray(),
ReturnTypeFullName: testDetails.ReturnType.FullName!
ReturnTypeFullName: testDetails.ReturnType.FullName!,
MethodArity: testDetails.TestMethod.GenericTypeCount
),

// Custom TUnit Properties
..testDetails.Categories.Select(category => new TestMetadataProperty(category, string.Empty)),
..testDetails.CustomProperties.Select(x => new TestMetadataProperty(x.Key, x.Value)),

// Artifacts
..testContext.Artifacts.Select(x => new FileArtifactProperty(x.File, x.DisplayName, x.Description)),

// TRX Report Properties
new TrxFullyQualifiedTypeNameProperty(testDetails.TestClass.Type.FullName!),
new TrxCategoriesProperty([..testDetails.Categories]),
Expand Down
14 changes: 10 additions & 4 deletions TUnit.Engine/Services/HookMessagePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ public async Task Discover(string sessionId, string displayName, StaticHookMetho
new LinePosition(hookMethod.LineNumber, 0))),
new TestMethodIdentifierProperty
(
hookMethod.Assembly.FullName!, hookMethod.ClassType.Namespace!,
hookMethod.ClassType.Name, hookMethod.Name,
hookMethod.Assembly.FullName!,
hookMethod.ClassType.Namespace!,
hookMethod.ClassType.Name,
hookMethod.Name,
hookMethod.MethodInfo.GenericTypeCount,
hookMethod.MethodInfo.Parameters.Select(x => x.Type.FullName!).ToArray(),
hookMethod.MethodInfo.ReturnType.FullName!
)
Expand Down Expand Up @@ -71,8 +74,11 @@ private async Task PublishAsync(string sessionId, string displayName, StaticHook
new TimingProperty(new TimingInfo(start, end, end - start)),
new TestMethodIdentifierProperty
(
hookMethod.Assembly.FullName!, hookMethod.ClassType.Namespace!,
hookMethod.ClassType.Name, hookMethod.Name,
hookMethod.Assembly.FullName!,
hookMethod.ClassType.Namespace!,
hookMethod.ClassType.Name,
hookMethod.Name,
hookMethod.MethodInfo.GenericTypeCount,
hookMethod.MethodInfo.Parameters.Select(x => x.Type.FullName!).ToArray(),
hookMethod.MethodInfo.ReturnType.FullName!
),
Expand Down
6 changes: 0 additions & 6 deletions TUnit.Engine/Services/SingleTestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,6 @@ await RunHelpers.RunValueTaskSafelyAsync(() => testSkippedEventReceiver.OnTestSk

await ExecuteStaticAfterHooks(test, testContext, cleanUpExceptions);

foreach (var artifact in testContext.Artifacts)
{
await messageBus.TestArtifact(testContext, artifact);
}

ExceptionsHelper.ThrowIfAny(cleanUpExceptions);
}
catch (Exception e)
Expand Down Expand Up @@ -514,6 +509,5 @@ public Task<bool> IsEnabledAsync()
public Type[] DataTypesProduced { get; } =
[
typeof(TestNodeUpdateMessage),
typeof(TestNodeFileArtifact)
];
}
15 changes: 1 addition & 14 deletions TUnit.Engine/TUnitMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ await context.MessageBus.PublishAsync(this,
);
}

public async ValueTask TestArtifact(TestContext testContext, Artifact artifact)
{
await context.MessageBus.PublishAsync(this,
new TestNodeFileArtifact(
context.Request.Session.SessionUid,
testContext.ToTestNode(),
artifact.File,
artifact.DisplayName,
artifact.Description
)
);
}

private static TimingProperty GetTimingProperty(TestContext testContext, DateTimeOffset overallStart)
{
if (overallStart == default)
Expand Down Expand Up @@ -227,5 +214,5 @@ public Task<bool> IsEnabledAsync()

public string Description => extension.Description;

public Type[] DataTypesProduced => [typeof(TestNodeUpdateMessage), typeof(SessionFileArtifact), typeof(TestNodeFileArtifact)];
public Type[] DataTypesProduced => [typeof(TestNodeUpdateMessage), typeof(SessionFileArtifact)];
}