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
12 changes: 6 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
TERM: "xterm"
steps:
- uses: actions/checkout@v4
- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.x
- name: Setup .NET 3.1.x
dotnet-version: 10.x
- name: Setup .NET 8.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
dotnet-version: "8.x"
- name: Configure NuGet cache
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -93,8 +93,8 @@ jobs:
**/test-results-*.xml
**/test-results-*.json
**/*.log
test/assets/**/bin/Debug/netcoreapp3.1/
test/assets/**/bin/Debug/net9.0/
test/assets/**/bin/Debug/net8.0/
test/assets/**/bin/Debug/net10.0/
- name: Codecov
uses: codecov/codecov-action@v3.1.0
with:
Expand Down
1 change: 1 addition & 0 deletions src/JUnit.Xml.Package/JUnit.Xml.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<PackageIcon>packageIcon.png</PackageIcon>
<IsPackable>true</IsPackable>
</PropertyGroup>

<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/NUnit.Xml.Package/NUnit.Xml.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Version>$(PackageVersion)</Version>
<AssemblyName>NUnitXml.TestLogger</AssemblyName>
<IsPackable>true</IsPackable>

<!-- This isn't an assembly -->
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
Expand Down
23 changes: 22 additions & 1 deletion src/TestLogger/Core/TestRunResultWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ string x when x.Equals("Legacy", StringComparison.OrdinalIgnoreCase) => legacyPa
var attachments = result.Attachments.SelectMany(x => x.ToAttachments(baseDirectory: GetTestResultDirectory(testRun), makeRelativePaths: testRun.LoggerConfiguration.UseRelativeAttachmentPaths)).ToList();

Func<string, string> sanitize = testRun.Serializer.InputSanitizer.Sanitize;

var traits = GetTraits(result.TestCase, sanitize);
testRun.Store.Add(new TestResultInfo(
sanitize(parsedName.Namespace),
sanitize(parsedName.Type),
Expand All @@ -177,7 +179,7 @@ string x when x.Equals("Legacy", StringComparison.OrdinalIgnoreCase) => legacyPa
sanitize(result.ErrorStackTrace),
result.Messages.Select(x => new TestResultMessage(sanitize(x.Category), sanitize(x.Text))).ToList(),
attachments,
result.TestCase.Traits.Select(x => new Trait(sanitize(x.Name), sanitize(x.Value))).ToList(),
traits,
result.TestCase.ExecutorUri?.ToString(),
result.TestCase));
}
Expand All @@ -188,5 +190,24 @@ private static string GetTestResultDirectory(ITestRun testRun)
.GetFormattedLogFilePath(testRun.RunConfiguration);
return Path.GetDirectoryName(logFilePath);
}

private static List<Trait> GetTraits(TestCase testCase, Func<string, string> sanitize)
{
// Workaround for test platform regression in .NET 10 SDK
// var traits = result.TestCase.Traits.Select(x => new Trait(sanitize(x.Name), sanitize(x.Value))).ToList();
var traits = new List<Trait>();
var traitProperty = testCase.Properties.FirstOrDefault(p => p.Id == "TestObject.Traits");
if (traitProperty != null)
{
var traitValues = testCase.GetPropertyValue(traitProperty, Enumerable.Empty<KeyValuePair<string, string>>());

foreach (var kvp in traitValues)
{
traits.Add(new Trait(sanitize(kvp.Key), sanitize(kvp.Value)));
}
}

return traits;
}
}
}
1 change: 1 addition & 0 deletions src/Xunit.Xml.Package/Xunit.Xml.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Version>$(PackageVersion)</Version>
<AssemblyName>XunitXml.TestLogger</AssemblyName>
<IsPackable>true</IsPackable>

<!-- This isn't an assembly -->
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class JUnitTestLoggerPathTests
{
private static readonly string[] ExpectedResultsFiles = new string[]
{
"JUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp90.test-results.xml",
"JUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp31.test-results.xml"
"JUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp100.test-results.xml",
"JUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp80.test-results.xml"
};

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

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Version>$(PackageVersion)</Version>
<AssemblyName>Sample.Json.TestLogger</AssemblyName>
<IsPackable>true</IsPackable>

<!-- This isn't an assembly -->
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void TestResultFileShouldContainAssemblyTestSuite(string resultFileName)

Assert.AreEqual("Failed", node.Attribute(XName.Get("result")).Value);
Assert.AreEqual("NUnit.Xml.TestLogger.NetCore.Tests.dll", node.Attribute(XName.Get("name")).Value);
Assert.AreEqual(AssetName.ToAssetAssemblyPath("netcoreapp3.1"), node.Attribute(XName.Get("fullname")).Value);
Assert.AreEqual(AssetName.ToAssetAssemblyPath("net8.0"), node.Attribute(XName.Get("fullname")).Value);

var startTimeStr = node.Attribute(XName.Get("start-time"))?.Value;
var endTimeStr = node.Attribute(XName.Get("end-time"))?.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class NUnitTestLoggerPathTests
{
private static readonly string[] ExpectedResultsFiles = new string[]
{
"NUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp90.test-results.xml",
"NUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp31.test-results.xml"
"NUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp100.test-results.xml",
"NUnit.Xml.TestLogger.NetMulti.Tests.NETCoreApp80.test-results.xml"
};

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

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
Name: bin/Debug/netcoreapp3.1/Json.TestLogger.MSTest.NetCore.Tests.dll,
Name: bin/Debug/net8.0/Json.TestLogger.MSTest.NetCore.Tests.dll,
Fixtures: [
{
Name: UnitTest1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
Name: bin/Debug/netcoreapp3.1/Json.TestLogger.NUnit.NetCore.Tests.dll,
Name: bin/Debug/net8.0/Json.TestLogger.NUnit.NetCore.Tests.dll,
Fixtures: [
{
Name: Issue28_Examples,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
Name: bin/Debug/netcoreapp3.1/Json.TestLogger.NUnit.NetCore.Tests.dll,
Name: bin/Debug/net8.0/Json.TestLogger.NUnit.NetCore.Tests.dll,
Fixtures: [
{
Name: Issue28_Examples,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
Name: bin/Debug/netcoreapp3.1/Json.TestLogger.XUnit.NetCore.Tests.dll,
Name: bin/Debug/net8.0/Json.TestLogger.XUnit.NetCore.Tests.dll,
Fixtures: [
{
Name: UnitTest1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand All @@ -21,20 +21,6 @@
<PackageReference Include="Verify.MSTest" />
</ItemGroup>

<!-- Build test assets for acceptance tests -->
<ItemGroup>
<TestAssets Include="$(MSBuildThisFileDirectory)../assets/Json.TestLogger.MSTest.NetCore.Tests/Json.TestLogger.MSTest.NetCore.Tests.csproj" />

<TestAssets Include="$(MSBuildThisFileDirectory)../assets/Json.TestLogger.NUnit.NetCore.Tests/Json.TestLogger.NUnit.NetCore.Tests.csproj" />

<TestAssets Include="$(MSBuildThisFileDirectory)../assets/Json.TestLogger.XUnit.NetCore.Tests/Json.TestLogger.XUnit.NetCore.Tests.csproj" />
</ItemGroup>
<Target Name="TestTarget" BeforeTargets="Build">
<Message Importance="High" Text="... Building test assets" />
<MSBuild Projects="@(TestAssets)" Properties="Configuration=$(Configuration)" Targets="Restore;Build" />
<Message Importance="High" Text="... Completed" />
</Target>

<ItemGroup>
<ProjectReference Include="..\Json.TestLogger\Json.TestLogger.csproj" />
<ProjectReference Include="..\TestLogger.Fixtures\TestLogger.Fixtures.csproj" />
Expand Down
5 changes: 1 addition & 4 deletions test/TestLogger.Fixtures/DotnetTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace TestLogger.Fixtures

public class DotnetTestFixture
{
private const string NetcoreVersion = "netcoreapp3.1";
private const string NetcoreVersion = "net8.0";
private bool buildProject = false;
private bool cleanProject = false;
private string relativeResultsDirectory = string.Empty;
Expand Down Expand Up @@ -109,9 +109,6 @@ public string Execute(string assemblyName, string loggerArgs, bool collectCovera

this.LogTestAssetOutDir(assemblyName);

// Required to skip icu requirement for netcoreapp3.1 in linux
dotnet.StartInfo.EnvironmentVariables["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "1";

Console.WriteLine("\n\n## Test run arguments: dotnet " + dotnet.StartInfo.Arguments);

// To avoid deadlocks, always read the output stream first and then wait.
Expand Down
2 changes: 1 addition & 1 deletion test/TestLogger.Fixtures/TestLogger.Fixtures.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion test/TestLogger.UnitTests/TestLogger.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Xunit.Xml.TestLogger.AcceptanceTests

public class TestRunFixture : IDisposable
{
private const string DotnetVersion = "netcoreapp3.1";
private const string DotnetVersion = "net8.0";

public TestRunFixture()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<WarningsAsErrors>true</WarningsAsErrors>
<EnableCodeAnalysis>true</EnableCodeAnalysis>
<IsPackable>false</IsPackable>
Expand Down
8 changes: 5 additions & 3 deletions test/assets/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<PropertyGroup>
<RunAnalyzers>false</RunAnalyzers>

<!-- https://github.com/dotnet/sdk/issues/37636 -->
<NoWarn>$(NoWarn);NETSDK1188</NoWarn>
<!-- https://github.com/dotnet/sdk/issues/37636
NU1903: known vulnerability in dependency warning doesn't make sense in test assets
-->
<NoWarn>$(NoWarn);NETSDK1188;NU1903</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,7 +18,7 @@
<XunitV3TestAdapterVersion>3.0.2</XunitV3TestAdapterVersion>
<NUnitVersion>3.13.2</NUnitVersion>
<NUnitTestAdapterVersion>4.0.0</NUnitTestAdapterVersion>
<MSTestVersion>3.4.3</MSTestVersion>
<MSTestVersion>3.0.4</MSTestVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(IsMTP)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

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

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net10.0;net8.0</TargetFrameworks>

<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework Condition="'$(UsesXunit3)'=='true'">net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition="'$(UsesXunit3)'=='true'">net10.0</TargetFramework>
<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NUnit.Xml.TestLogger.Tests2
public class AttachmentTest
{
public TestContext TestContext { get; set; }

[TestMethod]
public void TestAddAttachment()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework Condition="'$(UsesXunit3)'=='true'">net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition="'$(UsesXunit3)'=='true'">net10.0</TargetFramework>
<!-- Disable stylecop for test assets -->
<StylecopEnabled>false</StylecopEnabled>
</PropertyGroup>
Expand Down
Loading