Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRX Reporter for MultiNode tests #3904

Merged
merged 19 commits into from Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.fsx
Expand Up @@ -289,7 +289,7 @@ Target "MultiNodeTests" (fun _ ->

let args = StringBuilder()
|> append assembly
|> append (sprintf "-Dmultinode.teamcity=%b" hasTeamCity)
|> append (sprintf "-Dmultinode.reporter=%s" (if hasTeamCity then "teamcity" else "trx"))
valdisz marked this conversation as resolved.
Show resolved Hide resolved
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
Expand Down Expand Up @@ -328,7 +328,7 @@ Target "MultiNodeTestsNetCore" (fun _ ->
let args = StringBuilder()
|> append multiNodeTestPath
|> append assembly
|> append "-Dmultinode.teamcity=true"
|> append "-Dmultinode.reporter=trx"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append "-Dmultinode.platform=netcore"
Expand Down
30 changes: 30 additions & 0 deletions src/Akka.sln
Expand Up @@ -203,6 +203,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Persistence.TestKit.Te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.Persistence.TestKit.Xunit2", "core\Akka.Persistence.TestKit.Xunit2\Akka.Persistence.TestKit.Xunit2.csproj", "{6F8FECD6-6E39-473E-9B9A-9EE22CBF479F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.MultiNodeTestRunner.TrxReporter", "core\Akka.MultiNodeTestRunner.TrxReporter\Akka.MultiNodeTestRunner.TrxReporter.csproj", "{5A5EED03-BBC8-4664-986B-AE17EC3789A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.MultiNodeTestRunner.TrxReporter.Tests", "core\Akka.MultiNodeTestRunner.TrxReporter.Tests\Akka.MultiNodeTestRunner.TrxReporter.Tests.csproj", "{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -886,6 +890,30 @@ Global
{6F8FECD6-6E39-473E-9B9A-9EE22CBF479F}.Release|x64.Build.0 = Release|Any CPU
{6F8FECD6-6E39-473E-9B9A-9EE22CBF479F}.Release|x86.ActiveCfg = Release|Any CPU
{6F8FECD6-6E39-473E-9B9A-9EE22CBF479F}.Release|x86.Build.0 = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|x64.ActiveCfg = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|x64.Build.0 = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|x86.ActiveCfg = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Debug|x86.Build.0 = Debug|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|Any CPU.Build.0 = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|x64.ActiveCfg = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|x64.Build.0 = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|x86.ActiveCfg = Release|Any CPU
{5A5EED03-BBC8-4664-986B-AE17EC3789A9}.Release|x86.Build.0 = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|x64.ActiveCfg = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|x64.Build.0 = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|x86.ActiveCfg = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Debug|x86.Build.0 = Debug|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|Any CPU.Build.0 = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|x64.ActiveCfg = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|x64.Build.0 = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|x86.ActiveCfg = Release|Any CPU
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -974,6 +1002,8 @@ Global
{212A2D35-E8D1-46A7-A1D1-418CF9509D77} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
{22F6EA86-0079-41A0-9BD3-82D2D6C34638} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
{6F8FECD6-6E39-473E-9B9A-9EE22CBF479F} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
{5A5EED03-BBC8-4664-986B-AE17EC3789A9} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
{30744E10-73EC-46B9-ADE7-9D9D0EFF8010} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {03AD8E21-7507-4E68-A4E9-F4A7E7273164}
Expand Down
Expand Up @@ -49,7 +49,7 @@ public UnsubscribeFactCompletionMessages(IActorRef subscriber)
Subscriber = subscriber;
}


public IActorRef Subscriber { get; private set; }
}

Expand Down
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

<PropertyGroup>
<AssemblyTitle>Akka.MultiNodeTestRunner.AzureDevOps.Tests</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj" />
<ProjectReference Include="..\Akka.MultiNodeTestRunner.TrxReporter\Akka.MultiNodeTestRunner.TrxReporter.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
@@ -0,0 +1,84 @@
// -----------------------------------------------------------------------
// <copyright file="ResultSummaryTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
// -----------------------------------------------------------------------

namespace Akka.MultiNodeTestRunner.AzureDevOps.Tests
{
using System.Collections.Generic;
valdisz marked this conversation as resolved.
Show resolved Hide resolved
using FluentAssertions;
using Models;
using Xunit;

public class ResultSummaryTests
{
public static IEnumerable<object[]> ResultsSummaryOutcomeData
{
get
{
yield return new object[]
{
new UnitTest[] { },
TestOutcome.NotExecuted
};

yield return new object[]
{
new[]
{
new UnitTest("", "", Identifier.Empty, "")
{
Results =
{
new UnitTestResult(Identifier.Empty, Identifier.Empty, Identifier.Empty, "", "")
{
Outcome = TestOutcome.Passed
}
}
},
},
TestOutcome.Passed
};

yield return new object[]
{
new[]
{
new UnitTest("", "", Identifier.Empty, "")
{
Results =
{
new UnitTestResult(Identifier.Empty, Identifier.Empty, Identifier.Empty, "", "")
{
Outcome = TestOutcome.Passed
}
}
},
new UnitTest("", "", Identifier.Empty, "")
{
Results =
{
new UnitTestResult(Identifier.Empty, Identifier.Empty, Identifier.Empty, "", "")
{
Outcome = TestOutcome.Failed
}
}
},
},
TestOutcome.Failed
};
}
}

[Theory]
[MemberData(nameof(ResultsSummaryOutcomeData))]
public void ResultsSummaryOutcome(UnitTest[] tests, TestOutcome outcome)
{
var summary = new ResultSummary(tests, new Output());

summary.Outcome.ShouldBeEquivalentTo(outcome);
}
}
}
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkLibVersion);$(NetStandardLibVersion)</TargetFrameworks>
<LangVersion>latest</LangVersion>
valdisz marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Akka.MultiNodeTestRunner.Shared\Akka.MultiNodeTestRunner.Shared.csproj" />
<ProjectReference Include="..\Akka\Akka.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>

</Project>
26 changes: 26 additions & 0 deletions src/core/Akka.MultiNodeTestRunner.TrxReporter/Models/ErrorInfo.cs
@@ -0,0 +1,26 @@
// -----------------------------------------------------------------------
// <copyright file="ErrorInfo.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
// -----------------------------------------------------------------------

namespace Akka.MultiNodeTestRunner.AzureDevOps.Models
{
using System.Xml.Linq;
using static XmlHelper;

public class ErrorInfo : ITestEntity
{
public string Message { get; set; }
public string StackTrace { get; set; }

public XElement Serialize()
{
return Elem("ErrorInfo",
Elem("Message", Text(Message ?? "")),
Elem("StackTrace", Text(StackTrace ?? ""))
);
}
}
}
@@ -0,0 +1,16 @@
// -----------------------------------------------------------------------
// <copyright file="ITestEntity.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
// -----------------------------------------------------------------------

namespace Akka.MultiNodeTestRunner.AzureDevOps.Models
{
using System.Xml.Linq;

public interface ITestEntity
{
XElement Serialize();
}
}
29 changes: 29 additions & 0 deletions src/core/Akka.MultiNodeTestRunner.TrxReporter/Models/Identifier.cs
@@ -0,0 +1,29 @@
// -----------------------------------------------------------------------
// <copyright file="Identifier.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
// -----------------------------------------------------------------------

namespace Akka.MultiNodeTestRunner.AzureDevOps.Models
{
using System;

public struct Identifier
{
public Identifier(Guid value)
{
Value = value;
}

public static readonly Identifier Empty = Create(Guid.Empty);

public Guid Value { get; }

public override string ToString() => Value.ToString("D");

public static Identifier Create() => new Identifier(Guid.NewGuid());

public static Identifier Create(Guid value) => new Identifier(value);
}
}
43 changes: 43 additions & 0 deletions src/core/Akka.MultiNodeTestRunner.TrxReporter/Models/Output.cs
@@ -0,0 +1,43 @@
// -----------------------------------------------------------------------
// <copyright file="Output.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
// -----------------------------------------------------------------------

namespace Akka.MultiNodeTestRunner.AzureDevOps.Models
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using static XmlHelper;

public class Output : ITestEntity
{
public List<string> StdOut { get; } = new List<string>();
public List<string> StdErr { get; } = new List<string>();
public List<string> DebugTrace { get; } = new List<string>();
public ErrorInfo ErrorInfo { get; set; }
public List<string> TextMessages { get; } = new List<string>();

public XElement Serialize()
{
XElement TextElem(string element, List<string> lines) =>
lines.Count > 0
? Elem(element, Text(string.Join(Environment.NewLine, lines)))
: null;

return Elem("Output",
TextElem("StdOut", StdOut),
TextElem("StdErr", StdErr),
TextElem("DebugTrace", DebugTrace),
ErrorInfo,
ElemList(
"TextMessages",
TextMessages.Select(x => Elem("Message", Text(x)))
)
);
}
}
}