@@ -440,3 +440,37 @@ else
440
440
end
441
441
print_errors_summary 'findbugs-maven-plugin' , errors_count , 'https://github.com/php-coder/mystamps/wiki/findbugs'
442
442
end
443
+
444
+ # Handle `mvn robotframework:run` report
445
+ #
446
+ # Example:
447
+ # <suite source="/home/coder/mystamps/src/test/robotframework/category/access.robot" name="Access" id="s1-s1-s1">
448
+ # <test name="Create category with name in English and Russian" id="s1-s1-s2-s1-t2">
449
+ # <status critical="yes" endtime="20170301 20:27:07.476" starttime="20170301 20:27:06.810" status="FAIL">
450
+ # The text of element 'id=page-header' should have been 'Space!', but it was 'Space'.
451
+ # </status>
452
+ # </test>
453
+ # </suite>
454
+ rf_report = 'target/robotframework-reports/output.xml'
455
+ unless File . file? ( rf_report )
456
+ warn ( "Couldn't find #{ rf_report } . robotframework-maven-plugin result is unknown" )
457
+ else
458
+ errors_count = 0
459
+ doc = Nokogiri ::XML ( File . open ( rf_report ) )
460
+ doc . xpath ( '//status[@critical="yes"][@status="FAIL"]' ) . each do |node |
461
+ errors_count += 1
462
+ # find first parent's <suite> tag
463
+ suite = node . parent
464
+ while suite . name != 'suite'
465
+ suite = suite . parent
466
+ end
467
+ msg = node . text . sub ( /\. $/ , '' )
468
+ file = suite [ 'source' ] . sub ( pwd , '' )
469
+ file = github . html_link ( file )
470
+ testcase = node . parent [ 'name' ]
471
+ # TODO: try to findout the test case and use it for highlighting line numbers
472
+ fail ( "robotframework-maven-plugin error in #{ file } :\n Test case `#{ testcase } ` fails with message:\n #{ msg } " )
473
+ end
474
+ # TODO: add link to wiki page (#530)
475
+ print_errors_summary 'robotframework-maven-plugin' , errors_count
476
+ end
0 commit comments