-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save test results in JUnit XML Standard #207
Comments
That's a great idea. If anyone has a better spec please comment. I'll base the rest of this post off of this one: Linux Lighting Group. Until this gets implemented, you can make your own using a Hook script. In your hook script you can do XML Tag Mapping (in progress)The
|
You can export test results in the JUnit XML format specified here. You can specify a file name to export to, or kick off an export in a post-run hook. Setting the export fileThere are two settings, the file name and a flag to include an epoch timestamp in the filename. The epoch timestamp will prevent runs from overwritting the last run's file.
Exporting results in post-run HookHere is sample code to export results in a post-run hook script. See Hooks for more information about setting up a post-run script. Note that extends 'res://addons/gut/hook_script.gd'
func run() # called automatically by Gut
var exporter = JunitXmlExport.new()
var filename = 'user://my_post_hook_results.xml'
var f_result = exporter.write_file(gut, filename)
if(f_result == OK):
gut.p(str("Results saved to ", filename)) Example Output<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="GutTests" failures="7" tests="17">
<testsuite name="res://test/resources/exporter_test_files/test_simple_2.gd" tests="3" failures="1" skipped="1">
<testcase name="test_pass" assertions="1" status="pass" classname="res://test/resources/exporter_test_files/test_simple_2.gd"></testcase>
<testcase name="test_fail" assertions="1" status="fail" classname="res://test/resources/exporter_test_files/test_simple_2.gd">
<failure message="failed">Cannot compare Int[1] to String["two"].
at line 7</failure>
</testcase>
<testcase name="test_pending" assertions="0" status="pending" classname="res://test/resources/exporter_test_files/test_simple_2.gd">
<skipped message="pending">this has text</skipped>
</testcase>
</testsuite>
<testsuite name="res://test/resources/exporter_test_files/test_simple.gd" tests="8" failures="4" skipped="2">
<testcase name="test_pending_with_text" assertions="0" status="pending" classname="res://test/resources/exporter_test_files/test_simple.gd">
<skipped message="pending">this has text</skipped>
</testcase>
<testcase name="test_parameterized_passing" assertions="4" status="pass" classname="res://test/resources/exporter_test_files/test_simple.gd"></testcase>
<testcase name="test_parameterized_failing" assertions="2" status="fail" classname="res://test/resources/exporter_test_files/test_simple.gd">
<failure message="failed">(call #1) [1] expected to equal [2]:
at line 25</failure>
</testcase>
<testcase name="test_fail_2" assertions="1" status="fail" classname="res://test/resources/exporter_test_files/test_simple.gd">
<failure message="failed">Cannot compare String["two"] to Int[2].
at line 13</failure>
</testcase>
<testcase name="test_pending_no_text" assertions="0" status="pending" classname="res://test/resources/exporter_test_files/test_simple.gd">
<skipped message="pending"></skipped>
</testcase>
<testcase name="test_pass_1" assertions="1" status="pass" classname="res://test/resources/exporter_test_files/test_simple.gd"></testcase>
<testcase name="test_pass_2" assertions="1" status="pass" classname="res://test/resources/exporter_test_files/test_simple.gd"></testcase>
<testcase name="test_fail_1" assertions="1" status="fail" classname="res://test/resources/exporter_test_files/test_simple.gd">
<failure message="failed">Cannot compare Int[1] to String["two"].
at line 10</failure>
</testcase>
</testsuite>
<testsuite name="res://test/resources/exporter_test_files/test_with_inner_classes.gd" tests="0" failures="0" skipped="0"></testsuite>
<testsuite name="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassOne" tests="3" failures="1" skipped="1">
<testcase name="test_pending_with_text" assertions="0" status="pending" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassOne">
<skipped message="pending">this has text</skipped>
</testcase>
<testcase name="test_fail_1" assertions="1" status="fail" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassOne">
<failure message="failed">Cannot compare Int[1] to String["two"].
at line 11</failure>
</testcase>
<testcase name="test_pass_1" assertions="1" status="pass" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassOne"></testcase>
</testsuite>
<testsuite name="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassTwo" tests="3" failures="1" skipped="1">
<testcase name="test_pending_with_text" assertions="0" status="pending" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassTwo">
<skipped message="pending">this has text</skipped>
</testcase>
<testcase name="test_fail_1" assertions="1" status="fail" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassTwo">
<failure message="failed">Cannot compare Int[1] to String["two"].
at line 26</failure>
</testcase>
<testcase name="test_pass_1" assertions="1" status="pass" classname="res://test/resources/exporter_test_files/test_with_inner_classes.gd.TestClassTwo"></testcase>
</testsuite>
</testsuites> |
It would be helpful to bee able to save test results in JUnit XML Standard.
It is very popular format and many tools already support it. For example GitLab can display test CI job report on merge request page.
P.S.: If this is any help, WAT managed to do it: watplugin/wat#59
The text was updated successfully, but these errors were encountered: