@@ -75,18 +75,29 @@ private void ProcessTestRunnerEmit(string line)
7575 {
7676 var testEvent = JsonConvert . DeserializeObject < TestEvent > ( line ) ;
7777 // Extract test from list of tests
78- var test = _currentTests . Where ( n => n . DisplayName == testEvent . title ) ;
79- if ( test . Count ( ) > 0 )
78+ var tests = _currentTests . Where ( n => n . DisplayName == testEvent . title ) ;
79+ if ( tests . Count ( ) > 0 )
8080 {
81- if ( testEvent . type == "test start" )
81+ switch ( testEvent . type )
8282 {
83- _currentResult = new TestResult ( test . First ( ) ) ;
84- _currentResult . StartTime = DateTimeOffset . Now ;
85- _frameworkHandle . RecordStart ( test . First ( ) ) ;
86- }
87- else if ( testEvent . type == "result" )
88- {
89- RecordEnd ( _frameworkHandle , test . First ( ) , _currentResult , testEvent . result ) ;
83+ case "test start" :
84+ {
85+ _currentResult = new TestResult ( tests . First ( ) ) ;
86+ _currentResult . StartTime = DateTimeOffset . Now ;
87+ _frameworkHandle . RecordStart ( tests . First ( ) ) ;
88+ }
89+ break ;
90+ case "result" :
91+ {
92+ RecordEnd ( _frameworkHandle , tests . First ( ) , _currentResult , testEvent . result ) ;
93+ }
94+ break ;
95+ case "pending" :
96+ {
97+ _currentResult = new TestResult ( tests . First ( ) ) ;
98+ RecordEnd ( _frameworkHandle , tests . First ( ) , _currentResult , testEvent . result ) ;
99+ }
100+ break ;
90101 }
91102 }
92103 else if ( testEvent . type == "suite end" )
@@ -354,13 +365,20 @@ private NodejsProjectSettings LoadProjectSettings(string projectFile)
354365 } ;
355366 }
356367
357- private void RecordEnd ( IFrameworkHandle frameworkHandle , TestCase test , TestResult result , ResultObject resultObject )
358- {
359- var standardOutputLines = resultObject . stdout . Split ( '\n ' ) ;
360- var standardErrorLines = resultObject . stderr . Split ( '\n ' ) ;
361- result . EndTime = DateTimeOffset . Now ;
362- result . Duration = result . EndTime - result . StartTime ;
363- result . Outcome = resultObject . passed ? TestOutcome . Passed : TestOutcome . Failed ;
368+ private void RecordEnd ( IFrameworkHandle frameworkHandle , TestCase test , TestResult result , ResultObject resultObject ) {
369+ String [ ] standardOutputLines = resultObject . stdout . Split ( '\n ' ) ;
370+ String [ ] standardErrorLines = resultObject . stderr . Split ( '\n ' ) ;
371+
372+ if ( null != resultObject . pending && ( bool ) resultObject . pending )
373+ {
374+ result . Outcome = TestOutcome . Skipped ;
375+ }
376+ else
377+ {
378+ result . EndTime = DateTimeOffset . Now ;
379+ result . Duration = result . EndTime - result . StartTime ;
380+ result . Outcome = resultObject . passed ? TestOutcome . Passed : TestOutcome . Failed ;
381+ }
364382 result . Messages . Add ( new TestResultMessage ( TestResultMessage . StandardOutCategory , String . Join ( Environment . NewLine , standardOutputLines ) ) ) ;
365383 result . Messages . Add ( new TestResultMessage ( TestResultMessage . StandardErrorCategory , String . Join ( Environment . NewLine , standardErrorLines ) ) ) ;
366384 result . Messages . Add ( new TestResultMessage ( TestResultMessage . AdditionalInfoCategory , String . Join ( Environment . NewLine , standardErrorLines ) ) ) ;
@@ -420,11 +438,13 @@ public ResultObject()
420438 {
421439 title = String . Empty ;
422440 passed = false ;
441+ pending = false ;
423442 stdout = String . Empty ;
424443 stderr = String . Empty ;
425444 }
426445 public string title { get ; set ; }
427446 public bool passed { get ; set ; }
447+ public bool ? pending { get ; set ; }
428448 public string stdout { get ; set ; }
429449 public string stderr { get ; set ; }
430450}
0 commit comments