Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
38febc9
Migrate from `vstest` to `Microsoft.Testing.Platform` (#43)
Evangelink Oct 11, 2025
3fe7b21
Format
Tyrrrz Oct 11, 2025
a2b5bd6
wip
Tyrrrz Oct 11, 2025
3cd65bd
Format
Tyrrrz Oct 11, 2025
e42c6a6
asd
Tyrrrz Oct 11, 2025
ad398b2
asd
Tyrrrz Oct 11, 2025
d1c23fa
asd
Tyrrrz Oct 11, 2025
09cb57f
asd
Tyrrrz Oct 12, 2025
4e8b5df
Retrofit support for VSTest via an abstraction layer
Tyrrrz Oct 14, 2025
0fa368d
asd
Tyrrrz Oct 14, 2025
ee603f1
asd
Tyrrrz Oct 14, 2025
0ff54ee
asd
Tyrrrz Oct 14, 2025
b0959a1
asd
Tyrrrz Oct 14, 2025
2a04ac6
asd
Tyrrrz Oct 14, 2025
b375377
asd
Tyrrrz Oct 14, 2025
c3baa5e
asd
Tyrrrz Oct 14, 2025
7e73608
asd
Tyrrrz Oct 14, 2025
1ec70f8
asd
Tyrrrz Oct 14, 2025
baa088e
asd
Tyrrrz Oct 14, 2025
e202765
asd
Tyrrrz Oct 14, 2025
05fc4e5
asd
Tyrrrz Oct 15, 2025
3896f9a
asd
Tyrrrz Oct 15, 2025
4555bd6
asd
Tyrrrz Oct 15, 2025
d34bd30
asd
Tyrrrz Oct 15, 2025
86232b4
asd
Tyrrrz Oct 17, 2025
d418098
asd
Tyrrrz Oct 17, 2025
d680c00
asd
Tyrrrz Oct 17, 2025
1084ae2
MTP demo works
Tyrrrz Oct 22, 2025
af06bef
asd
Tyrrrz Oct 25, 2025
23601ff
asd
Tyrrrz Nov 1, 2025
ed6a032
asd
Tyrrrz Nov 1, 2025
201dcae
asd
Tyrrrz Nov 3, 2025
460ef7b
Upgrade to MTP v2
Tyrrrz Nov 11, 2025
77f8f51
asd
Tyrrrz Nov 11, 2025
12e4e65
Merge
Tyrrrz Nov 11, 2025
ab562cc
asd
Tyrrrz Nov 11, 2025
c367f57
Use peer deps
Tyrrrz Nov 12, 2025
f4582b9
tests
Tyrrrz Nov 14, 2025
80ff683
Async github interactions
Tyrrrz Nov 14, 2025
65a9c48
Add MTP tests
Tyrrrz Nov 17, 2025
3c4f5d5
asd
Tyrrrz Nov 17, 2025
29a8325
asd
Tyrrrz Nov 17, 2025
b6a8c73
Migrate demo projects to MSTest
Tyrrrz Nov 17, 2025
b25749c
asd
Tyrrrz Nov 17, 2025
423a9d9
asd
Tyrrrz Nov 17, 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
36 changes: 18 additions & 18 deletions GitHubActionsTestLogger.Tests/AnnotationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public void I_can_use_the_logger_to_produce_annotations_for_failed_tests()
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand Down Expand Up @@ -54,9 +54,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_source_info
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand Down Expand Up @@ -104,9 +104,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_source_info
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand Down Expand Up @@ -155,9 +155,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_the_test_na
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions
new TestReporterOptions
{
AnnotationTitleFormat = "<@test>",
AnnotationMessageFormat = "[@test]",
Expand All @@ -184,9 +184,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_test_traits
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions
new TestReporterOptions
{
AnnotationTitleFormat = "<@traits.Category -> @test>",
AnnotationMessageFormat = "[@traits.Category -> @test]",
Expand Down Expand Up @@ -218,9 +218,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_the_error_m
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions
new TestReporterOptions
{
AnnotationTitleFormat = "<@test: @error>",
AnnotationMessageFormat = "[@test: @error]",
Expand Down Expand Up @@ -251,9 +251,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_the_error_s
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions
new TestReporterOptions
{
AnnotationTitleFormat = "<@test: @trace>",
AnnotationMessageFormat = "[@test: @trace]",
Expand Down Expand Up @@ -284,9 +284,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_the_target_
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions
new TestReporterOptions
{
AnnotationTitleFormat = "<@test (@framework)>",
AnnotationMessageFormat = "[@test (@framework)]",
Expand Down Expand Up @@ -319,9 +319,9 @@ public void I_can_use_the_logger_to_produce_annotations_that_include_line_breaks
// Arrange
using var commandWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(commandWriter, TextWriter.Null),
new TestLoggerOptions { AnnotationMessageFormat = "foo\\nbar" }
new TestReporterOptions { AnnotationMessageFormat = "foo\\nbar" }
);

// Act
Expand Down
4 changes: 2 additions & 2 deletions GitHubActionsTestLogger.Tests/InitializationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void I_can_use_the_logger_with_the_default_configuration()

// Assert
logger.Context.Should().NotBeNull();
logger.Context?.Options.Should().BeEquivalentTo(TestLoggerOptions.Default);
logger.Context?.Options.Should().BeEquivalentTo(TestReporterOptions.Default);
}

[Fact]
Expand All @@ -35,7 +35,7 @@ public void I_can_use_the_logger_with_an_empty_configuration()

// Assert
logger.Context.Should().NotBeNull();
logger.Context?.Options.Should().BeEquivalentTo(TestLoggerOptions.Default);
logger.Context?.Options.Should().BeEquivalentTo(TestReporterOptions.Default);
}

[Fact]
Expand Down
24 changes: 12 additions & 12 deletions GitHubActionsTestLogger.Tests/SummarySpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_includes_the_test_sui
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand All @@ -38,9 +38,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_includes_the_list_of_
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
new TestLoggerOptions { SummaryIncludePassedTests = true }
new TestReporterOptions { SummaryIncludePassedTests = true }
);

// Act
Expand Down Expand Up @@ -85,9 +85,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_includes_the_list_of_
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand Down Expand Up @@ -144,9 +144,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_includes_the_list_of_
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
new TestLoggerOptions { SummaryIncludeSkippedTests = true }
new TestReporterOptions { SummaryIncludeSkippedTests = true }
);

// Act
Expand Down Expand Up @@ -191,9 +191,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_includes_empty_test_s
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
TestLoggerOptions.Default
TestReporterOptions.Default
);

// Act
Expand All @@ -212,9 +212,9 @@ public void I_can_use_the_logger_to_produce_a_summary_that_does_not_include_empt
// Arrange
using var summaryWriter = new StringWriter();

var context = new TestLoggerContext(
var context = new TestReporterContext(
new GitHubWorkflow(TextWriter.Null, summaryWriter),
new TestLoggerOptions { SummaryIncludeNotFoundTests = false }
new TestReporterOptions { SummaryIncludeNotFoundTests = false }
);

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace GitHubActionsTestLogger.Tests.Utils.Extensions;
internal static class TestLoggerContextExtensions
{
public static void SimulateTestRun(
this TestLoggerContext context,
this TestReporterContext context,
string testSuiteFilePath,
string targetFrameworkName,
params IReadOnlyList<TestResult> testResults
Expand Down Expand Up @@ -65,13 +65,13 @@ params IReadOnlyList<TestResult> testResults
}

public static void SimulateTestRun(
this TestLoggerContext context,
this TestReporterContext context,
string testSuiteName,
params IReadOnlyList<TestResult> testResults
) => context.SimulateTestRun(testSuiteName, "FakeTargetFramework", testResults);

public static void SimulateTestRun(
this TestLoggerContext context,
this TestReporterContext context,
params IReadOnlyList<TestResult> testResults
) => context.SimulateTestRun("FakeTests.dll", testResults);
}
4 changes: 2 additions & 2 deletions GitHubActionsTestLogger/GitHubActionsTestLogger.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net9.0</TargetFrameworks>
<IsPackable>true</IsPackable>
Expand Down Expand Up @@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="1.1.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.14.1" />
<PackageReference Include="Microsoft.Testing.Platform" Version="1.6.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.15.0" PrivateAssets="all" />
<PackageReference
Expand Down
26 changes: 26 additions & 0 deletions GitHubActionsTestLogger/GitHubReportExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.Testing.Platform.Builder;
using Microsoft.Testing.Platform.Extensions;
using Microsoft.Testing.Platform.Services;

namespace GitHubActionsTestLogger;

public static class GitHubReportExtensions
{
/// <summary>
/// Adds GitHub Actions reporting support to the Testing Platform Builder.
/// </summary>
public static void AddGitHubReportProvider(this ITestApplicationBuilder testApplicationBuilder)
{
var extension = new TestReporterExtension();

var compositeExtension = new CompositeExtensionFactory<TestReporter>(
serviceProvider => new TestReporter(extension, serviceProvider.GetCommandLineOptions())
);
testApplicationBuilder.TestHost.AddDataConsumer(compositeExtension);
testApplicationBuilder.TestHost.AddTestSessionLifetimeHandle(compositeExtension);

testApplicationBuilder.CommandLine.AddProvider(() =>
new TestReporterOptionsProvider(extension)
);
}
}
4 changes: 2 additions & 2 deletions GitHubActionsTestLogger/GitHubWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace GitHubActionsTestLogger;

// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
public partial class GitHubWorkflow(TextWriter commandWriter, TextWriter summaryWriter)
internal partial class GitHubWorkflow(TextWriter commandWriter, TextWriter summaryWriter)
{
private void InvokeCommand(
string command,
Expand Down Expand Up @@ -78,7 +78,7 @@ public void CreateSummary(string content)
}
}

public partial class GitHubWorkflow
internal partial class GitHubWorkflow
{
public static GitHubWorkflow Default { get; } =
new(
Expand Down
9 changes: 9 additions & 0 deletions GitHubActionsTestLogger/TestDefinition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections.Generic;

namespace GitHubActionsTestLogger;

internal record TestDefinition(
string Id,
string DisplayName,
IReadOnlyDictionary<string, string> Properties
);
29 changes: 0 additions & 29 deletions GitHubActionsTestLogger/TestLogger.cs

This file was deleted.

Loading
Loading