зеркало из
1
0
Форкнуть 0

#73 Add an environment variable to suppress parsing TeamCity service message from NUnit events

This commit is contained in:
NikolayPianikov 2020-02-28 11:12:07 +03:00
Родитель 209bb69459
Коммит 66b15ddd3b
9 изменённых файлов: 512 добавлений и 28 удалений

Просмотреть файл

@ -13,5 +13,7 @@
string SuitePattern { get; }
string ColonReplacement { get; }
bool SuppressParsingMessagesInside(string eventId);
}
}

Просмотреть файл

@ -164,9 +164,9 @@
{
yield return message;
}
}
}
private static IEnumerable<ServiceMessage> TestFinished(EventId eventId, XmlNode testFinishedEvent)
private IEnumerable<ServiceMessage> TestFinished(EventId eventId, XmlNode testFinishedEvent)
{
if (testFinishedEvent == null)
{
@ -197,7 +197,7 @@
new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId));
}
private static IEnumerable<ServiceMessage> TestFailed(EventId eventId, XmlNode testFailedEvent, XmlNode infoSource)
private IEnumerable<ServiceMessage> TestFailed(EventId eventId, XmlNode testFailedEvent, XmlNode infoSource)
{
if (testFailedEvent == null)
{
@ -224,7 +224,7 @@
}
}
private static IEnumerable<ServiceMessage> TestSkipped(EventId eventId, XmlNode testSkippedEvent)
private IEnumerable<ServiceMessage> TestSkipped(EventId eventId, XmlNode testSkippedEvent)
{
if (testSkippedEvent == null)
{
@ -244,7 +244,7 @@
new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId));
}
private static IEnumerable<ServiceMessage> TestInconclusive(EventId eventId, XmlNode testInconclusiveEvent)
private IEnumerable<ServiceMessage> TestInconclusive(EventId eventId, XmlNode testInconclusiveEvent)
{
if (testInconclusiveEvent == null)
{
@ -262,34 +262,49 @@
new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId));
}
private static IEnumerable<ServiceMessage> Output(EventId eventId, string messageName, string outputStr)
private IEnumerable<ServiceMessage> Output(EventId eventId, string messageName, string outputStr)
{
if (string.IsNullOrEmpty(outputStr))
{
yield break;
}
yield return new ServiceMessage(messageName,
var attributes = new List<ServiceMessageAttr>
{
new ServiceMessageAttr(ServiceMessageAttr.Names.Name, eventId.FullName),
new ServiceMessageAttr(ServiceMessageAttr.Names.Out, outputStr),
new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId),
new ServiceMessageAttr(ServiceMessageAttr.Names.TcTags, TcParseServiceMessagesInside));
new ServiceMessageAttr(ServiceMessageAttr.Names.Out, outputStr)
};
attributes.AddRange(GetAttributes(eventId, messageName));
yield return new ServiceMessage(messageName, attributes);
}
private static IEnumerable<ServiceMessage> OutputAsMessage(EventId eventId, string outputStr)
private IEnumerable<ServiceMessage> OutputAsMessage(EventId eventId, string outputStr)
{
if (string.IsNullOrEmpty(outputStr))
{
yield break;
}
yield return new ServiceMessage(ServiceMessage.Names.Message,
new ServiceMessageAttr(ServiceMessageAttr.Names.Text, outputStr),
new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId),
new ServiceMessageAttr(ServiceMessageAttr.Names.TcTags, TcParseServiceMessagesInside));
var attributes = new List<ServiceMessageAttr>
{
new ServiceMessageAttr(ServiceMessageAttr.Names.Text, outputStr)
};
attributes.AddRange(GetAttributes(eventId, ServiceMessage.Names.Message));
yield return new ServiceMessage(ServiceMessage.Names.Message, attributes);
}
private static IEnumerable<ServiceMessage> Output(EventId eventId, XmlNode sendOutputEvent)
private IEnumerable<ServiceMessageAttr> GetAttributes(EventId eventId, string messageName)
{
yield return new ServiceMessageAttr(ServiceMessageAttr.Names.FlowId, eventId.FlowId);
if (!_teamCityInfo.SuppressParsingMessagesInside(messageName))
{
yield return new ServiceMessageAttr(ServiceMessageAttr.Names.TcTags, TcParseServiceMessagesInside);
}
}
private IEnumerable<ServiceMessage> Output(EventId eventId, XmlNode sendOutputEvent)
{
if (sendOutputEvent == null) throw new ArgumentNullException("sendOutputEvent");
@ -305,7 +320,7 @@
}
}
private static IEnumerable<ServiceMessage> ReasonMessage(EventId eventId, XmlNode ev)
private IEnumerable<ServiceMessage> ReasonMessage(EventId eventId, XmlNode ev)
{
if (ev == null) throw new ArgumentNullException("ev");

Просмотреть файл

@ -1,6 +1,7 @@
namespace NUnit.Engine.Listeners
{
using System;
using System.Collections.Generic;
public class TeamCityInfo: ITeamCityInfo
{
@ -17,6 +18,17 @@
private static readonly bool AllowDiagnosticsValue = GetBool(Environment.GetEnvironmentVariable("TEAMCITY_NUNIT_DIAG"), false);
private static readonly string SuitePatternValue = Environment.GetEnvironmentVariable("TEAMCITY_NUNIT_SUITE_PATTERN") ?? "";
private static readonly string ColonReplacementValue = Environment.GetEnvironmentVariable("TEAMCITY_COLON_REPLACEMENT") ?? "<colon>";
// Semicolon separated list of TeamCity message names (testStdOut;testStdErr;testFailed;testIgnored...) to suppress parsing TeamCity messages inside a parent message
private static readonly string MessagesToSuppressParsingMessagesInsideValue = Environment.GetEnvironmentVariable("TEAMCITY_SUPPRESS_PARSING_INSIDE") ?? "";
private static readonly Dictionary<string, string> MessagesToSuppressParsingMessagesInside = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
static TeamCityInfo()
{
foreach (var eventId in MessagesToSuppressParsingMessagesInsideValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
MessagesToSuppressParsingMessagesInside[eventId] = string.Empty;
}
}
public bool MetadataEnabled
{
@ -48,6 +60,11 @@
get { return ColonReplacementValue; }
}
public bool SuppressParsingMessagesInside(string eventId)
{
return MessagesToSuppressParsingMessagesInside.ContainsKey(eventId);
}
private static bool GetBool(string value, bool defaultValue)
{
bool result;

Просмотреть файл

@ -1132,4 +1132,68 @@ Scenario: Generate suite name according to variable TEAMCITY_NUNIT_SUITE_PATTERN
| testFinished | Foo.Tests.UnitTests1.SuccessfulTest | | \d+ | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
| testSuiteFinished | x64_foo.tests_abc | | | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
@3.9
@teamcity
Scenario Outline: NUnit sends TeamCity service without parseServiceMessagesInside tag
Given Framework version is <frameworkVersion>
And I added SuccessfulStdError method as SuccessfulStdErrorTest to the class Foo.Tests.UnitTests1 for foo.tests
And I created the folder mocks
And I added NUnit framework references to foo.tests
And I copied NUnit framework references to folder mocks
And I compiled the assembly foo.tests to file mocks\foo.tests.dll
And I added the assembly mocks\foo.tests.dll to the list of testing assemblies
And I want to use CmdArguments type of TeamCity integration
And I added the environment variable TEAMCITY_SUPPRESS_PARSING_INSIDE as testStdERR
When I run NUnit console
Then the exit code should be 0
And the output should contain correct set of TeamCity service messages
And the output should contain TeamCity service messages:
| | name | captureStandardOutput | duration | flowId | parent | message | details | out | tc:tags |
| flowStarted | | | | .+ | .+ | | | | |
| testSuiteStarted | foo.tests.dll | | | .+ | | | | | |
| flowStarted | | | | .+ | .+ | | | | |
| testStarted | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | false | | .+ | | | | | |
| testStdErr | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | | .+ | | | | errorout | ^((?!tc:parseServiceMessagesInside).)*$ |
| testStdOut | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | | .+ | | | | stdout | tc:parseServiceMessagesInside |
| testFinished | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | \d+ | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
| testSuiteFinished | foo.tests.dll | | | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
Examples:
| frameworkVersion |
| Version45 |
| Version40 |
@3.9
@teamcity
Scenario Outline: NUnit sends TeamCity service without parseServiceMessagesInside tag for several mesage types
Given Framework version is <frameworkVersion>
And I added SuccessfulStdError method as SuccessfulStdErrorTest to the class Foo.Tests.UnitTests1 for foo.tests
And I created the folder mocks
And I added NUnit framework references to foo.tests
And I copied NUnit framework references to folder mocks
And I compiled the assembly foo.tests to file mocks\foo.tests.dll
And I added the assembly mocks\foo.tests.dll to the list of testing assemblies
And I want to use CmdArguments type of TeamCity integration
And I added the environment variable TEAMCITY_SUPPRESS_PARSING_INSIDE as testStdERR;teststdout
When I run NUnit console
Then the exit code should be 0
And the output should contain correct set of TeamCity service messages
And the output should contain TeamCity service messages:
| | name | captureStandardOutput | duration | flowId | parent | message | details | out | tc:tags |
| flowStarted | | | | .+ | .+ | | | | |
| testSuiteStarted | foo.tests.dll | | | .+ | | | | | |
| flowStarted | | | | .+ | .+ | | | | |
| testStarted | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | false | | .+ | | | | | |
| testStdErr | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | | .+ | | | | errorout | ^((?!tc:parseServiceMessagesInside).)*$ |
| testStdOut | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | | .+ | | | | stdout | ^((?!tc:parseServiceMessagesInside).)*$ |
| testFinished | Foo.Tests.UnitTests1.SuccessfulStdErrorTest | | \d+ | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
| testSuiteFinished | foo.tests.dll | | | .+ | | | | | |
| flowFinished | | | | .+ | | | | | |
Examples:
| frameworkVersion |
| Version45 |
| Version40 |

351
src/nunit.integration.tests/TeamCity.feature.cs сгенерированный
Просмотреть файл

@ -5422,6 +5422,357 @@ this.FeatureBackground();
""});
#line 1125
testRunner.And("the output should contain TeamCity service messages:", ((string)(null)), table57, "And ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("NUnit sends TeamCity service without parseServiceMessagesInside tag")]
[NUnit.Framework.CategoryAttribute("3.9")]
[NUnit.Framework.CategoryAttribute("teamcity")]
[NUnit.Framework.TestCaseAttribute("Version45", null)]
[NUnit.Framework.TestCaseAttribute("Version40", null)]
public virtual void NUnitSendsTeamCityServiceWithoutParseServiceMessagesInsideTag(string frameworkVersion, string[] exampleTags)
{
string[] @__tags = new string[] {
"3.9",
"teamcity"};
if ((exampleTags != null))
{
@__tags = System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Concat(@__tags, exampleTags));
}
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("NUnit sends TeamCity service without parseServiceMessagesInside tag", null, @__tags);
#line 1139
this.ScenarioInitialize(scenarioInfo);
this.ScenarioStart();
#line 3
this.FeatureBackground();
#line 1140
testRunner.Given(string.Format("Framework version is {0}", frameworkVersion), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 1141
testRunner.And("I added SuccessfulStdError method as SuccessfulStdErrorTest to the class Foo.Test" +
"s.UnitTests1 for foo.tests", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1142
testRunner.And("I created the folder mocks", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1143
testRunner.And("I added NUnit framework references to foo.tests", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1144
testRunner.And("I copied NUnit framework references to folder mocks", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1145
testRunner.And("I compiled the assembly foo.tests to file mocks\\foo.tests.dll", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1146
testRunner.And("I added the assembly mocks\\foo.tests.dll to the list of testing assemblies", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1147
testRunner.And("I want to use CmdArguments type of TeamCity integration", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1148
testRunner.And("I added the environment variable TEAMCITY_SUPPRESS_PARSING_INSIDE as testStdERR", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1149
testRunner.When("I run NUnit console", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 1150
testRunner.Then("the exit code should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 1151
testRunner.And("the output should contain correct set of TeamCity service messages", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table58 = new TechTalk.SpecFlow.Table(new string[] {
"",
"name",
"captureStandardOutput",
"duration",
"flowId",
"parent",
"message",
"details",
"out",
"tc:tags"});
table58.AddRow(new string[] {
"flowStarted",
"",
"",
"",
".+",
".+",
"",
"",
"",
""});
table58.AddRow(new string[] {
"testSuiteStarted",
"foo.tests.dll",
"",
"",
".+",
"",
"",
"",
"",
""});
table58.AddRow(new string[] {
"flowStarted",
"",
"",
"",
".+",
".+",
"",
"",
"",
""});
table58.AddRow(new string[] {
"testStarted",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"false",
"",
".+",
"",
"",
"",
"",
""});
table58.AddRow(new string[] {
"testStdErr",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"",
".+",
"",
"",
"",
"errorout",
"^((?!tc:parseServiceMessagesInside).)*$"});
table58.AddRow(new string[] {
"testStdOut",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"",
".+",
"",
"",
"",
"stdout",
"tc:parseServiceMessagesInside"});
table58.AddRow(new string[] {
"testFinished",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"\\d+",
".+",
"",
"",
"",
"",
""});
table58.AddRow(new string[] {
"flowFinished",
"",
"",
"",
".+",
"",
"",
"",
"",
""});
table58.AddRow(new string[] {
"testSuiteFinished",
"foo.tests.dll",
"",
"",
".+",
"",
"",
"",
"",
""});
table58.AddRow(new string[] {
"flowFinished",
"",
"",
"",
".+",
"",
"",
"",
"",
""});
#line 1152
testRunner.And("the output should contain TeamCity service messages:", ((string)(null)), table58, "And ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("NUnit sends TeamCity service without parseServiceMessagesInside tag for several m" +
"esage types")]
[NUnit.Framework.CategoryAttribute("3.9")]
[NUnit.Framework.CategoryAttribute("teamcity")]
[NUnit.Framework.TestCaseAttribute("Version45", null)]
[NUnit.Framework.TestCaseAttribute("Version40", null)]
public virtual void NUnitSendsTeamCityServiceWithoutParseServiceMessagesInsideTagForSeveralMesageTypes(string frameworkVersion, string[] exampleTags)
{
string[] @__tags = new string[] {
"3.9",
"teamcity"};
if ((exampleTags != null))
{
@__tags = System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Concat(@__tags, exampleTags));
}
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("NUnit sends TeamCity service without parseServiceMessagesInside tag for several m" +
"esage types", null, @__tags);
#line 1171
this.ScenarioInitialize(scenarioInfo);
this.ScenarioStart();
#line 3
this.FeatureBackground();
#line 1172
testRunner.Given(string.Format("Framework version is {0}", frameworkVersion), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 1173
testRunner.And("I added SuccessfulStdError method as SuccessfulStdErrorTest to the class Foo.Test" +
"s.UnitTests1 for foo.tests", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1174
testRunner.And("I created the folder mocks", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1175
testRunner.And("I added NUnit framework references to foo.tests", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1176
testRunner.And("I copied NUnit framework references to folder mocks", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1177
testRunner.And("I compiled the assembly foo.tests to file mocks\\foo.tests.dll", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1178
testRunner.And("I added the assembly mocks\\foo.tests.dll to the list of testing assemblies", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1179
testRunner.And("I want to use CmdArguments type of TeamCity integration", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1180
testRunner.And("I added the environment variable TEAMCITY_SUPPRESS_PARSING_INSIDE as testStdERR;t" +
"eststdout", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 1181
testRunner.When("I run NUnit console", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 1182
testRunner.Then("the exit code should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 1183
testRunner.And("the output should contain correct set of TeamCity service messages", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table59 = new TechTalk.SpecFlow.Table(new string[] {
"",
"name",
"captureStandardOutput",
"duration",
"flowId",
"parent",
"message",
"details",
"out",
"tc:tags"});
table59.AddRow(new string[] {
"flowStarted",
"",
"",
"",
".+",
".+",
"",
"",
"",
""});
table59.AddRow(new string[] {
"testSuiteStarted",
"foo.tests.dll",
"",
"",
".+",
"",
"",
"",
"",
""});
table59.AddRow(new string[] {
"flowStarted",
"",
"",
"",
".+",
".+",
"",
"",
"",
""});
table59.AddRow(new string[] {
"testStarted",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"false",
"",
".+",
"",
"",
"",
"",
""});
table59.AddRow(new string[] {
"testStdErr",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"",
".+",
"",
"",
"",
"errorout",
"^((?!tc:parseServiceMessagesInside).)*$"});
table59.AddRow(new string[] {
"testStdOut",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"",
".+",
"",
"",
"",
"stdout",
"^((?!tc:parseServiceMessagesInside).)*$"});
table59.AddRow(new string[] {
"testFinished",
"Foo.Tests.UnitTests1.SuccessfulStdErrorTest",
"",
"\\d+",
".+",
"",
"",
"",
"",
""});
table59.AddRow(new string[] {
"flowFinished",
"",
"",
"",
".+",
"",
"",
"",
"",
""});
table59.AddRow(new string[] {
"testSuiteFinished",
"foo.tests.dll",
"",
"",
".+",
"",
"",
"",
"",
""});
table59.AddRow(new string[] {
"flowFinished",
"",
"",
"",
".+",
"",
"",
"",
"",
""});
#line 1184
testRunner.And("the output should contain TeamCity service messages:", ((string)(null)), table59, "And ");
#line hidden
this.ScenarioCleanup();
}

Просмотреть файл

@ -123,7 +123,7 @@ this.FeatureBackground();
#line 18
testRunner.Then("the exit code should be 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table58 = new TechTalk.SpecFlow.Table(new string[] {
TechTalk.SpecFlow.Table table60 = new TechTalk.SpecFlow.Table(new string[] {
"",
"name",
"captureStandardOutput",
@ -134,7 +134,7 @@ this.FeatureBackground();
"details",
"out",
"tc:tags"});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"testSuiteStarted",
"foo.tests.dll",
"",
@ -145,7 +145,7 @@ this.FeatureBackground();
"",
"",
""});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"flowStarted",
"",
"",
@ -156,7 +156,7 @@ this.FeatureBackground();
"",
"",
""});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"testStarted",
"Foo.Tests.UnitTests1.SuccessfulTest",
"false",
@ -167,7 +167,7 @@ this.FeatureBackground();
"",
"",
""});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"testStdOut",
"Foo.Tests.UnitTests1.SuccessfulTest",
"",
@ -178,7 +178,7 @@ this.FeatureBackground();
"",
"output",
"tc:parseServiceMessagesInside"});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"testFinished",
"Foo.Tests.UnitTests1.SuccessfulTest",
"",
@ -189,7 +189,7 @@ this.FeatureBackground();
"",
"",
""});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"flowFinished",
"",
"",
@ -200,7 +200,7 @@ this.FeatureBackground();
"",
"",
""});
table58.AddRow(new string[] {
table60.AddRow(new string[] {
"testSuiteFinished",
"foo.tests.dll",
"",
@ -212,7 +212,7 @@ this.FeatureBackground();
"",
""});
#line 19
testRunner.And("the output should contain TeamCity service messages:", ((string)(null)), table58, "And ");
testRunner.And("the output should contain TeamCity service messages:", ((string)(null)), table60, "And ");
#line hidden
this.ScenarioCleanup();
}

Просмотреть файл

@ -71,6 +71,11 @@
public string SuitePattern { get; set; }
public string ColonReplacement { get; set; }
public bool SuppressParsingMessagesInside(string eventId)
{
return false;
}
}
}
}

Просмотреть файл

@ -392,6 +392,29 @@ namespace NUnit.Engine.Listeners
_output.ToString());
}
[Test]
public void ShouldSuppressParsingMessagesInside()
{
// Given
var publisher = CreateInstance(new MyTeamCityInfo { SuppressParsingMessagesInsideValue = true });
// When
publisher.RegisterMessage(TestUtil.CreateStartRun(1));
// Test Assembly1.Namespace1.1.Test1
publisher.RegisterMessage(TestUtil.CreateStartTest("1-1", "", "Assembly1.Namespace1.1.Test1"));
publisher.RegisterMessage(TestUtil.CreateTestCaseSuccessful("1-1", "", "Assembly1.Namespace1.1.Test1", "0.1", "Text output"));
publisher.RegisterMessage(TestUtil.CreateTestRun());
// Then
Assert.AreEqual(
"##teamcity[testStarted name='Assembly1.Namespace1.1.Test1' captureStandardOutput='false' flowId='1-1']" + Environment.NewLine
+ "##teamcity[testStdOut name='Assembly1.Namespace1.1.Test1' out='Text output' flowId='1-1']" + Environment.NewLine
+ "##teamcity[testFinished name='Assembly1.Namespace1.1.Test1' duration='100' flowId='1-1']" + Environment.NewLine,
_output.ToString());
}
private TeamCityEventListener CreateInstance(ITeamCityInfo teamCityInfo = null)
{
return new TeamCityEventListener(_outputWriter, teamCityInfo != null ? teamCityInfo : new TeamCityInfo()) { RootFlowId = string.Empty };
@ -410,6 +433,13 @@ namespace NUnit.Engine.Listeners
public string SuitePattern { get; set; }
public string ColonReplacement { get; set; }
public bool SuppressParsingMessagesInsideValue { get; set; }
public bool SuppressParsingMessagesInside(string eventId)
{
return SuppressParsingMessagesInsideValue;
}
}
}
}

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.30.0" />
<package id="Cake" version="0.37.0" />
</packages>