diff --git a/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs b/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs
index ab0a51f1..03fbf548 100644
--- a/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs
+++ b/GoogleTestAdapter/Core.Tests/TestResults/StandardOutputTestResultParserTests.cs
@@ -102,6 +102,34 @@ public class StandardOutputTestResultParserTests : TestsBase
@"[ PASSED ] 2 test.",
};
+ ///
+ ///
+ ///
+ private string[] ConsoleOutputWithSkippedTest { get; } = @"[==========] Running 3 tests from 1 test suite.
+[----------] Global test environment set-up.
+[----------] 3 tests from Test
+[ RUN ] Test.Succeed
+[ OK ] Test.Succeed (0 ms)
+[ RUN ] Test.Skip
+[ SKIPPED ] Test.Skip (1 ms)
+[ RUN ] Test.Fail
+C:\...\test.cpp(14): error: Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] Test.Fail (0 ms)
+[----------] 3 tests from Test (3 ms total)
+
+[----------] Global test environment tear-down
+[==========] 3 tests from 1 test suite ran. (6 ms total)
+[ PASSED ] 1 test.
+[ SKIPPED ] 1 test, listed below:
+[ SKIPPED ] Test.Skip
+[ FAILED ] 1 test, listed below:
+[ FAILED ] Test.Fail
+
+ 1 FAILED TEST
+".Split('\n');
+
private List CrashesImmediately { get; set; }
private List CrashesAfterErrorMsg { get; set; }
@@ -276,6 +304,34 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound()
XmlTestResultParserTests.AssertTestResultIsPassed(results[1]);
}
+ [TestMethod]
+ [TestCategory(Unit)]
+ public void GetTestResults_OutputWithSkippedTest_AllResultsAreFound()
+ {
+ var cases = new List
+ {
+ TestDataCreator.ToTestCase("Test.Succeed", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ TestDataCreator.ToTestCase("Test.Skip", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ TestDataCreator.ToTestCase("Test.Fail", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ };
+
+ var results = new StandardOutputTestResultParser(cases, ConsoleOutputWithSkippedTest, TestEnvironment.Logger).GetTestResults();
+
+ results.Should().HaveCount(3);
+
+ var result = results[0];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Succeed");
+ XmlTestResultParserTests.AssertTestResultIsPassed(result);
+
+ result = results[1];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Skip");
+ XmlTestResultParserTests.AssertTestResultIsSkipped(result);
+
+ result = results[2];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Fail");
+ XmlTestResultParserTests.AssertTestResultIsFailure(result);
+ }
+
[TestMethod]
[TestCategory(Unit)]
public void OutputHandling_OutputManyLinesWithNewlines_IsParsedCorrectly()
diff --git a/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs b/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs
index 9793c055..ec7148db 100644
--- a/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs
+++ b/GoogleTestAdapter/Core.Tests/TestResults/StreamingStandardOutputTestResultParserTests.cs
@@ -114,6 +114,34 @@ public class StreamingStandardOutputTestResultParserTests : TestsBase
@"[ PASSED ] 2 test.",
};
+ ///
+ ///
+ ///
+ private string[] ConsoleOutputWithSkippedTest { get; } = @"[==========] Running 3 tests from 1 test suite.
+[----------] Global test environment set-up.
+[----------] 3 tests from Test
+[ RUN ] Test.Succeed
+[ OK ] Test.Succeed (0 ms)
+[ RUN ] Test.Skip
+[ SKIPPED ] Test.Skip (1 ms)
+[ RUN ] Test.Fail
+C:\...\test.cpp(14): error: Value of: false
+ Actual: false
+Expected: true
+[ FAILED ] Test.Fail (0 ms)
+[----------] 3 tests from Test (3 ms total)
+
+[----------] Global test environment tear-down
+[==========] 3 tests from 1 test suite ran. (6 ms total)
+[ PASSED ] 1 test.
+[ SKIPPED ] 1 test, listed below:
+[ SKIPPED ] Test.Skip
+[ FAILED ] 1 test, listed below:
+[ FAILED ] Test.Fail
+
+ 1 FAILED TEST
+".Split('\n');
+
private List CrashesImmediately { get; set; }
private List CrashesAfterErrorMsg { get; set; }
@@ -313,8 +341,10 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound()
@"c:\users\chris\documents\visual studio 2015\projects\consoleapplication1\consoleapplication1tests\source.cpp")
};
- var results = new StandardOutputTestResultParser(cases, ConsoleOutputWithPrefixingTest, TestEnvironment.Logger)
- .GetTestResults();
+ var parser = new StreamingStandardOutputTestResultParser(cases, MockLogger.Object, MockFrameworkReporter.Object, String.Empty);
+ ConsoleOutputWithPrefixingTest.ToList().ForEach(parser.ReportLine);
+ parser.Flush();
+ var results = parser.TestResults;
results.Count.Should().Be(2);
results[0].TestCase.FullyQualifiedName.Should().Be("Test.AB");
@@ -323,6 +353,37 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound()
XmlTestResultParserTests.AssertTestResultIsPassed(results[1]);
}
+ [TestMethod]
+ [TestCategory(Unit)]
+ public void GetTestResults_OutputWithSkippedTest_AllResultsAreFound()
+ {
+ var cases = new List
+ {
+ TestDataCreator.ToTestCase("Test.Succeed", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ TestDataCreator.ToTestCase("Test.Skip", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ TestDataCreator.ToTestCase("Test.Fail", TestDataCreator.DummyExecutable, @"c:\somepath\source.cpp"),
+ };
+
+ var parser = new StreamingStandardOutputTestResultParser(cases, MockLogger.Object, MockFrameworkReporter.Object, String.Empty);
+ ConsoleOutputWithSkippedTest.ToList().ForEach(parser.ReportLine);
+ parser.Flush();
+ var results = parser.TestResults;
+
+ results.Should().HaveCount(3);
+
+ var result = results[0];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Succeed");
+ XmlTestResultParserTests.AssertTestResultIsPassed(result);
+
+ result = results[1];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Skip");
+ XmlTestResultParserTests.AssertTestResultIsSkipped(result);
+
+ result = results[2];
+ result.TestCase.FullyQualifiedName.Should().Be("Test.Fail");
+ XmlTestResultParserTests.AssertTestResultIsFailure(result);
+ }
+
[TestMethod]
[TestCategory(Unit)]
public void OutputHandling_OutputManyLinesWithNewlines_IsParsedCorrectly()
diff --git a/GoogleTestAdapter/Core.Tests/TestResults/XmlTestResultParserTests.cs b/GoogleTestAdapter/Core.Tests/TestResults/XmlTestResultParserTests.cs
index ae800120..4eeb007b 100644
--- a/GoogleTestAdapter/Core.Tests/TestResults/XmlTestResultParserTests.cs
+++ b/GoogleTestAdapter/Core.Tests/TestResults/XmlTestResultParserTests.cs
@@ -171,7 +171,7 @@ public static void AssertTestResultIsPassed(Model.TestResult testResult)
testResult.ErrorMessage.Should().BeNull();
}
- private void AssertTestResultIsSkipped(Model.TestResult testResult)
+ public static void AssertTestResultIsSkipped(Model.TestResult testResult)
{
testResult.Outcome.Should().Be(Model.TestOutcome.Skipped);
testResult.ErrorMessage.Should().BeNull();
diff --git a/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs b/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs
index 7e7bf0df..db939da1 100644
--- a/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs
+++ b/GoogleTestAdapter/Core/TestResults/StandardOutputTestResultParser.cs
@@ -15,6 +15,7 @@ public class StandardOutputTestResultParser
private const string Run = "[ RUN ]";
public const string Failed = "[ FAILED ]";
public const string Passed = "[ OK ]";
+ public const string Skipped = "[ SKIPPED ]";
public const string FailedFixture = "SetUpTestSuite or TearDownTestSuite";
public static readonly string CrashText = Resources.CrashText;
@@ -80,7 +81,7 @@ private TestResult CreateTestResult(int indexOfTestcase)
string errorMsg = "";
- while (!(IsFailedLine(line) || IsPassedLine(line)) && currentLineIndex <= _consoleOutput.Count)
+ while (!(IsFailedLine(line) || IsPassedLine(line) || IsSkippedLine(line)) && currentLineIndex <= _consoleOutput.Count)
{
errorMsg += line + "\n";
line = currentLineIndex < _consoleOutput.Count ? _consoleOutput[currentLineIndex] : "";
@@ -97,6 +98,10 @@ private TestResult CreateTestResult(int indexOfTestcase)
{
return CreatePassedTestResult(testCase, ParseDuration(line));
}
+ if (IsSkippedLine(line))
+ {
+ return CreateSkippedTestResult(testCase, ParseDuration(line));
+ }
CrashedTestCase = testCase;
string message = CrashText;
@@ -163,6 +168,17 @@ public static TestResult CreatePassedTestResult(TestCase testCase, TimeSpan dura
};
}
+ public static TestResult CreateSkippedTestResult(TestCase testCase, TimeSpan duration)
+ {
+ return new TestResult(testCase)
+ {
+ ComputerName = Environment.MachineName,
+ DisplayName = testCase.DisplayName,
+ Outcome = TestOutcome.Skipped,
+ Duration = duration
+ };
+ }
+
public static TestResult CreateFailedTestResult(TestCase testCase, TimeSpan duration, string errorMessage, string errorStackTrace)
{
return new TestResult(testCase)
@@ -215,6 +231,11 @@ public static bool IsFailedLine(string line)
return line.StartsWith(Failed, StringComparison.Ordinal);
}
+ public static bool IsSkippedLine(string line)
+ {
+ return line.StartsWith(Skipped);
+ }
+
public static string RemovePrefix(string line)
{
return line.Substring(Run.Length);
diff --git a/GoogleTestAdapter/Core/TestResults/StreamingStandardOutputTestResultParser.cs b/GoogleTestAdapter/Core/TestResults/StreamingStandardOutputTestResultParser.cs
index b38de858..9b9c9a73 100644
--- a/GoogleTestAdapter/Core/TestResults/StreamingStandardOutputTestResultParser.cs
+++ b/GoogleTestAdapter/Core/TestResults/StreamingStandardOutputTestResultParser.cs
@@ -177,7 +177,8 @@ private TestResult CreateTestResult()
string errorMsg = "";
while (
!(StandardOutputTestResultParser.IsFailedLine(line)
- || StandardOutputTestResultParser.IsPassedLine(line))
+ || StandardOutputTestResultParser.IsPassedLine(line)
+ || StandardOutputTestResultParser.IsSkippedLine(line))
&& currentLineIndex <= _consoleOutput.Count)
{
errorMsg += line + "\n";
@@ -229,6 +230,12 @@ private TestResult CreateTestResult()
testCase,
StandardOutputTestResultParser.ParseDuration(line, _logger));
}
+ if (StandardOutputTestResultParser.IsSkippedLine(line))
+ {
+ return StandardOutputTestResultParser.CreateSkippedTestResult(
+ testCase,
+ StandardOutputTestResultParser.ParseDuration(line, _logger));
+ }
CrashedTestCase = testCase;
string message = StandardOutputTestResultParser.CrashText;