From 3bd503c2578c2f5904348e413f65a9730eb0e778 Mon Sep 17 00:00:00 2001 From: obligaron Date: Sun, 15 Dec 2024 21:16:34 +0100 Subject: [PATCH] MsTest: Only use TestContext for output and not Console.WriteLine --- CHANGELOG.md | 1 + Plugins/Reqnroll.MSTest.ReqnrollPlugin/MSTestTraceListener.cs | 2 -- .../Reqnroll.TestProjectGenerator/TRXParser.cs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1408b2c41..7ccb0767b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Improve parameter type naming for generic types (#343) ## Bug fixes: +* MsTest: Only use TestContext for output and not Console.WriteLine (#368) *Contributors of this release (in alphabetical order):* @clrudolphi, @obligaron, @olegKoshmeliuk diff --git a/Plugins/Reqnroll.MSTest.ReqnrollPlugin/MSTestTraceListener.cs b/Plugins/Reqnroll.MSTest.ReqnrollPlugin/MSTestTraceListener.cs index 7ff315def..9527b8744 100644 --- a/Plugins/Reqnroll.MSTest.ReqnrollPlugin/MSTestTraceListener.cs +++ b/Plugins/Reqnroll.MSTest.ReqnrollPlugin/MSTestTraceListener.cs @@ -15,13 +15,11 @@ public MSTestTraceListener(ITraceListenerQueue traceListenerQueue, IObjectContai public override void WriteTestOutput(string message) { _testContextProvider.GetTestContext().WriteLine(message); - base.WriteTestOutput(message); } public override void WriteToolOutput(string message) { _testContextProvider.GetTestContext().WriteLine("-> " + message); - base.WriteToolOutput(message); } } } \ No newline at end of file diff --git a/Tests/TestProjectGenerator/Reqnroll.TestProjectGenerator/TRXParser.cs b/Tests/TestProjectGenerator/Reqnroll.TestProjectGenerator/TRXParser.cs index ac78c19e8..88a65cd4d 100644 --- a/Tests/TestProjectGenerator/Reqnroll.TestProjectGenerator/TRXParser.cs +++ b/Tests/TestProjectGenerator/Reqnroll.TestProjectGenerator/TRXParser.cs @@ -184,7 +184,7 @@ private static IEnumerable ParseTestOutput(XElement stdOutElemen var logLines = stdOutText.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries); - var primaryOutput = logLines.TakeWhile(line => line != "TestContext Messages:"); + var primaryOutput = logLines.Where(line => line != "TestContext Messages:"); TestStepResult step = null;