Skip to content

Commit db7f33a

Browse files
committed
handle robotframework tests
1 parent 546039e commit db7f33a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Dangerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,37 @@ else
375375
end
376376
print_errors_summary 'findbugs-maven-plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/findbugs'
377377
end
378+
379+
# Handle `mvn robotframework:run` report
380+
#
381+
# Example:
382+
# <suite source="/home/coder/mystamps/src/test/robotframework/category/access.robot" name="Access" id="s1-s1-s1">
383+
# <test name="Create category with name in English and Russian" id="s1-s1-s2-s1-t2">
384+
# <status critical="yes" endtime="20170301 20:27:07.476" starttime="20170301 20:27:06.810" status="FAIL">
385+
# The text of element 'id=page-header' should have been 'Space!', but it was 'Space'.
386+
# </status>
387+
# </test>
388+
# </suite>
389+
rf_report = 'target/robotframework-reports/output.xml'
390+
unless File.file?(rf_report)
391+
warn("Couldn't find #{rf_report}. robotframework-maven-plugin result is unknown")
392+
else
393+
errors_count = 0
394+
doc = Nokogiri::XML(File.open(rf_report))
395+
doc.xpath('//status[@critical="yes"][@status="FAIL"]').each do |node|
396+
errors_count += 1
397+
# find first parent's <suite> tag
398+
suite = node.parent
399+
while suite.name != 'suite'
400+
suite = suite.parent
401+
end
402+
msg = node.text.sub(/\.$/, '')
403+
file = suite['source'].sub(pwd, '')
404+
file = github.html_link(file)
405+
testcase = node.parent['name']
406+
# TODO: try to findout the test case and use it for highlighting line numbers
407+
fail("robotframework-maven-plugin error in #{file}:\nTest case `#{testcase}` fails with message:\n#{msg}")
408+
end
409+
# TODO: add link to wiki page (#530)
410+
print_errors_summary 'robotframework-maven-plugin', errors_count
411+
end

0 commit comments

Comments
 (0)