@@ -151,7 +151,7 @@ export class TestControllerManager {
151151 public readonly debugManager : DebugManager ,
152152 public readonly outputChannel : vscode . OutputChannel ,
153153 ) {
154- this . testController = vscode . tests . createTestController ( "robotCode.RobotFramework" , "RobotFramework " ) ;
154+ this . testController = vscode . tests . createTestController ( "robotCode.RobotFramework" , "Robot Framework " ) ;
155155
156156 this . testController . resolveHandler = async ( item ) => {
157157 await this . refresh ( item ) ;
@@ -264,7 +264,6 @@ export class TestControllerManager {
264264 this . TestRunExited ( event . session . configuration . runId ) ;
265265 break ;
266266 }
267-
268267 case "robotStarted" : {
269268 this . OnRobotStartedEvent ( event . session . configuration . runId , event . body as RobotExecutionEvent ) ;
270269 break ;
@@ -273,6 +272,10 @@ export class TestControllerManager {
273272 this . OnRobotEndedEvent ( event . session . configuration . runId , event . body as RobotExecutionEvent ) ;
274273 break ;
275274 }
275+ case "robotSetFailed" : {
276+ this . OnRobotSetFailed ( event . session . configuration . runId , event . body as RobotExecutionEvent ) ;
277+ break ;
278+ }
276279 case "robotEnqueued" : {
277280 this . TestItemEnqueued ( event . session . configuration . runId , event . body ?. items ) ;
278281 break ;
@@ -1202,20 +1205,64 @@ export class TestControllerManager {
12021205 }
12031206 }
12041207
1208+ private OnRobotSetFailed ( runId : string | undefined , event : RobotExecutionEvent ) {
1209+ switch ( event . type ) {
1210+ case "suite" :
1211+ case "test" :
1212+ this . TestItemSetFailed ( runId , event ) ;
1213+ break ;
1214+ default :
1215+ // do nothing
1216+ break ;
1217+ }
1218+ }
1219+
1220+ private TestItemSetFailed ( runId : string | undefined , event : RobotExecutionEvent ) {
1221+ if ( runId === undefined || event . attributes ?. longname === undefined ) return ;
1222+
1223+ const run = this . testRuns . get ( runId ) ;
1224+
1225+ if ( run !== undefined ) {
1226+ const item = this . findTestItemById ( event . id ) ;
1227+ if ( item ) {
1228+ const message = new vscode . TestMessage ( event . attributes ?. message ?? "" ) ;
1229+
1230+ if ( event . attributes . source ) {
1231+ message . location = new vscode . Location (
1232+ vscode . Uri . file ( event . attributes . source ) ,
1233+ new vscode . Range (
1234+ new vscode . Position ( ( event . attributes . lineno ?? 1 ) - 1 , 0 ) ,
1235+ new vscode . Position ( event . attributes . lineno ?? 1 , 0 ) ,
1236+ ) ,
1237+ ) ;
1238+ }
1239+
1240+ if ( event . attributes . status === "SKIP" ) {
1241+ run . skipped ( item ) ;
1242+ } else if ( event . attributes . status === "FAIL" ) {
1243+ run . failed ( item , message , event . attributes . elapsedtime ) ;
1244+ } else if ( event . attributes . status === "ERROR" ) {
1245+ run . errored ( item , message , event . attributes . elapsedtime ) ;
1246+ }
1247+ }
1248+ }
1249+ }
1250+
12051251 private TestItemEnded ( runId : string | undefined , event : RobotExecutionEvent ) {
12061252 if ( runId === undefined || event . attributes ?. longname === undefined ) return ;
12071253
12081254 const run = this . testRuns . get ( runId ) ;
12091255
12101256 if ( run !== undefined ) {
12111257 const item = this . findTestItemById ( event . id ) ;
1258+
12121259 if ( item !== undefined ) {
12131260 switch ( event . attributes . status ) {
12141261 case "PASS" :
1215- run . passed ( item , event . attributes . elapsedtime ) ;
1262+ if ( ! item ?. canResolveChildren ) run . passed ( item , event . attributes . elapsedtime ) ;
12161263 break ;
12171264 case "SKIP" :
1218- run . skipped ( item ) ;
1265+ if ( ! item ?. canResolveChildren ) run . skipped ( item ) ;
12191266 break ;
12201267 default :
12211268 {
@@ -1256,10 +1303,12 @@ export class TestControllerManager {
12561303 messages . push ( message ) ;
12571304 }
12581305
1259- if ( event . attributes . status === "FAIL" ) {
1260- run . failed ( item , messages , event . attributes . elapsedtime ) ;
1261- } else {
1262- run . errored ( item , messages , event . attributes . elapsedtime ) ;
1306+ if ( ! item ?. canResolveChildren ) {
1307+ if ( event . attributes . status === "FAIL" ) {
1308+ run . failed ( item , messages , event . attributes . elapsedtime ) ;
1309+ } else {
1310+ run . errored ( item , messages , event . attributes . elapsedtime ) ;
1311+ }
12631312 }
12641313 }
12651314 break ;
0 commit comments