@@ -102,6 +102,62 @@ public class StandardOutputTestResultParserTests : TestsBase
102102 @"[ PASSED ] 2 test." ,
103103 } ;
104104
105+ /// <summary>
106+ /// <see cref="https://github.com/csoltenborn/GoogleTestAdapter/issues/260"/>
107+ /// </summary>
108+ private string [ ] ConsoleOutputWithSkippedTest { get ; } = @"[==========] Running 3 tests from 1 test suite.
109+ [----------] Global test environment set-up.
110+ [----------] 3 tests from Test
111+ [ RUN ] Test.Succeed
112+ [ OK ] Test.Succeed (0 ms)
113+ [ RUN ] Test.Skip
114+ [ SKIPPED ] Test.Skip (1 ms)
115+ [ RUN ] Test.Fail
116+ C:\...\test.cpp(14): error: Value of: false
117+ Actual: false
118+ Expected: true
119+ [ FAILED ] Test.Fail (0 ms)
120+ [----------] 3 tests from Test (3 ms total)
121+
122+ [----------] Global test environment tear-down
123+ [==========] 3 tests from 1 test suite ran. (6 ms total)
124+ [ PASSED ] 1 test.
125+ [ SKIPPED ] 1 test, listed below:
126+ [ SKIPPED ] Test.Skip
127+ [ FAILED ] 1 test, listed below:
128+ [ FAILED ] Test.Fail
129+
130+ 1 FAILED TEST
131+ " . Split ( '\n ' ) ;
132+
133+ /// <summary>
134+ /// <see cref="https://github.com/csoltenborn/GoogleTestAdapter/issues/260"/>
135+ /// </summary>
136+ private string [ ] ConsoleOutputWithSkippedTestAsLastTest { get ; } = @"[==========] Running 3 tests from 1 test suite.
137+ [----------] Global test environment set-up.
138+ [----------] 3 tests from Test
139+ [ RUN ] Test.Succeed
140+ [ OK ] Test.Succeed (0 ms)
141+ [ RUN ] Test.Fail
142+ C:\...\test.cpp(14): error: Value of: false
143+ Actual: false
144+ Expected: true
145+ [ FAILED ] Test.Fail (0 ms)
146+ [ RUN ] Test.Skip
147+ [ SKIPPED ] Test.Skip (1 ms)
148+ [----------] 3 tests from Test (3 ms total)
149+
150+ [----------] Global test environment tear-down
151+ [==========] 3 tests from 1 test suite ran. (6 ms total)
152+ [ PASSED ] 1 test.
153+ [ SKIPPED ] 1 test, listed below:
154+ [ SKIPPED ] Test.Skip
155+ [ FAILED ] 1 test, listed below:
156+ [ FAILED ] Test.Fail
157+
158+ 1 FAILED TEST
159+ " . Split ( '\n ' ) ;
160+
105161
106162 private List < string > CrashesImmediately { get ; set ; }
107163 private List < string > CrashesAfterErrorMsg { get ; set ; }
@@ -139,7 +195,7 @@ public override void SetUp()
139195 [ TestCategory ( Unit ) ]
140196 public void GetTestResults_CompleteOutput_ParsedCorrectly ( )
141197 {
142- List < TestResult > results = ComputeTestResults ( Complete ) ;
198+ var results = ComputeTestResults ( Complete ) ;
143199
144200 results . Should ( ) . HaveCount ( 3 ) ;
145201
@@ -165,7 +221,7 @@ public void GetTestResults_CompleteOutput_ParsedCorrectly()
165221 [ TestCategory ( Unit ) ]
166222 public void GetTestResults_OutputWithImmediateCrash_CorrectResultHasCrashText ( )
167223 {
168- List < TestResult > results = ComputeTestResults ( CrashesImmediately ) ;
224+ var results = ComputeTestResults ( CrashesImmediately ) ;
169225
170226 results . Should ( ) . HaveCount ( 2 ) ;
171227
@@ -186,7 +242,7 @@ public void GetTestResults_OutputWithImmediateCrash_CorrectResultHasCrashText()
186242 [ TestCategory ( Unit ) ]
187243 public void GetTestResults_OutputWithCrashAfterErrorMessage_CorrectResultHasCrashText ( )
188244 {
189- List < TestResult > results = ComputeTestResults ( CrashesAfterErrorMsg ) ;
245+ var results = ComputeTestResults ( CrashesAfterErrorMsg ) ;
190246
191247 results . Should ( ) . HaveCount ( 3 ) ;
192248
@@ -212,7 +268,7 @@ public void GetTestResults_OutputWithCrashAfterErrorMessage_CorrectResultHasCras
212268 [ TestCategory ( Unit ) ]
213269 public void GetTestResults_OutputWithInvalidDurationUnit_DefaultDurationIsUsedAndWarningIsProduced ( )
214270 {
215- List < TestResult > results = ComputeTestResults ( WrongDurationUnit ) ;
271+ var results = ComputeTestResults ( WrongDurationUnit ) ;
216272
217273 results . Should ( ) . ContainSingle ( ) ;
218274 results [ 0 ] . TestCase . FullyQualifiedName . Should ( ) . Be ( "TestMath.AddFails" ) ;
@@ -231,7 +287,7 @@ public void GetTestResults_OutputWithThousandsSeparatorInDuration_ParsedCorrectl
231287 Thread . CurrentThread . CurrentCulture = CultureInfo . GetCultureInfo ( "en-US" ) ;
232288 try
233289 {
234- List < TestResult > results = ComputeTestResults ( ThousandsSeparatorInDuration ) ;
290+ var results = ComputeTestResults ( ThousandsSeparatorInDuration ) ;
235291
236292 results . Should ( ) . ContainSingle ( ) ;
237293 results [ 0 ] . TestCase . FullyQualifiedName . Should ( ) . Be ( "TestMath.AddFails" ) ;
@@ -247,7 +303,7 @@ public void GetTestResults_OutputWithThousandsSeparatorInDuration_ParsedCorrectl
247303 [ TestCategory ( Unit ) ]
248304 public void GetTestResults_OutputWithConsoleOutput_ConsoleOutputIsIgnored ( )
249305 {
250- List < TestResult > results = ComputeTestResults ( PassingTestProducesConsoleOutput ) ;
306+ var results = ComputeTestResults ( PassingTestProducesConsoleOutput ) ;
251307
252308 results . Should ( ) . ContainSingle ( ) ;
253309 results [ 0 ] . TestCase . FullyQualifiedName . Should ( ) . Be ( "TestMath.AddPasses" ) ;
@@ -276,6 +332,62 @@ public void GetTestResults_OutputWithPrefixingTest_BothTestsAreFound()
276332 XmlTestResultParserTests . AssertTestResultIsPassed ( results [ 1 ] ) ;
277333 }
278334
335+ [ TestMethod ]
336+ [ TestCategory ( Unit ) ]
337+ public void GetTestResults_OutputWithSkippedTest_AllResultsAreFound ( )
338+ {
339+ var cases = new List < TestCase >
340+ {
341+ TestDataCreator . ToTestCase ( "Test.Succeed" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
342+ TestDataCreator . ToTestCase ( "Test.Skip" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
343+ TestDataCreator . ToTestCase ( "Test.Fail" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
344+ } ;
345+
346+ var results = new StandardOutputTestResultParser ( cases , ConsoleOutputWithSkippedTest , TestEnvironment . Logger ) . GetTestResults ( ) ;
347+
348+ results . Should ( ) . HaveCount ( 3 ) ;
349+
350+ var result = results [ 0 ] ;
351+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Succeed" ) ;
352+ XmlTestResultParserTests . AssertTestResultIsPassed ( result ) ;
353+
354+ result = results [ 1 ] ;
355+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Skip" ) ;
356+ XmlTestResultParserTests . AssertTestResultIsSkipped ( result ) ;
357+
358+ result = results [ 2 ] ;
359+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Fail" ) ;
360+ XmlTestResultParserTests . AssertTestResultIsFailure ( result ) ;
361+ }
362+
363+ [ TestMethod ]
364+ [ TestCategory ( Unit ) ]
365+ public void GetTestResults_OutputWithSkippedTestAsLastTest_AllResultsAreFound ( )
366+ {
367+ var cases = new List < TestCase >
368+ {
369+ TestDataCreator . ToTestCase ( "Test.Succeed" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
370+ TestDataCreator . ToTestCase ( "Test.Skip" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
371+ TestDataCreator . ToTestCase ( "Test.Fail" , TestDataCreator . DummyExecutable , @"c:\somepath\source.cpp" ) ,
372+ } ;
373+
374+ var results = new StandardOutputTestResultParser ( cases , ConsoleOutputWithSkippedTestAsLastTest , TestEnvironment . Logger ) . GetTestResults ( ) ;
375+
376+ results . Should ( ) . HaveCount ( 3 ) ;
377+
378+ var result = results [ 0 ] ;
379+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Succeed" ) ;
380+ XmlTestResultParserTests . AssertTestResultIsPassed ( result ) ;
381+
382+ result = results [ 1 ] ;
383+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Fail" ) ;
384+ XmlTestResultParserTests . AssertTestResultIsFailure ( result ) ;
385+
386+ result = results [ 2 ] ;
387+ result . TestCase . FullyQualifiedName . Should ( ) . Be ( "Test.Skip" ) ;
388+ XmlTestResultParserTests . AssertTestResultIsSkipped ( result ) ;
389+ }
390+
279391 [ TestMethod ]
280392 [ TestCategory ( Unit ) ]
281393 public void OutputHandling_OutputManyLinesWithNewlines_IsParsedCorrectly ( )
@@ -357,7 +469,7 @@ private IList<TestResult> GetTestResultsFromCompleteOutputFile()
357469 }
358470
359471
360- private List < TestResult > ComputeTestResults ( List < string > consoleOutput )
472+ private IList < TestResult > ComputeTestResults ( List < string > consoleOutput )
361473 {
362474 var cases = new List < TestCase >
363475 {
0 commit comments