Skip to content

feat: support test case property #52

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func ingestSuite(root xmlNode) Suite {
suite.Tests = append(suite.Tests, testcase)
case "properties":
props := ingestProperties(node)
suite.Properties = props
for k, v := range props {
suite.Properties[k] = v
}
case "system-out":
suite.SystemOut = string(node.Content)
case "system-err":
Expand Down Expand Up @@ -90,6 +92,11 @@ func ingestTestcase(root xmlNode) Test {
test.Status = StatusError
test.Message = node.Attr("message")
test.Error = ingestError(node)
case "properties":
props := ingestProperties(node)
for k, v := range props {
test.Properties[k] = v
}
case "system-out":
test.SystemOut = string(node.Content)
case "system-err":
Expand Down
2 changes: 2 additions & 0 deletions ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func TestExamplesInTheWild(t *testing.T) {
assertLen(t, suites[0].Tests, 1)
assertEqual(t, "\n I am stdout!\n ", suites[0].Tests[0].SystemOut)
assertEqual(t, "\n I am stderr!\n ", suites[0].Tests[0].SystemErr)
assertEqual(t, "some.property.value", suites[0].Tests[0].Properties["some.property.name"])
assertEqual(t, "some.class.name", suites[0].Tests[0].Properties["classname"])
},
},
{
Expand Down
9 changes: 8 additions & 1 deletion testdata/cubic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@
type=""
></failure>

<!-- Data that was written to standard out while the test was executed. optional -->
<!-- Properties (e.g., environment settings) set during test
execution. The properties element can appear 0 or once. -->
<properties>
<!-- property can appear multiple times. The name and value attributres are required. -->
<property name="" value=""/>
</properties>

<!-- Data that was written to standard out while the test was executed. optional -->
<system-out>STDOUT text</system-out>

<!-- Data that was written to standard error while the test was executed. optional -->
Expand Down
3 changes: 3 additions & 0 deletions testdata/python-junit-xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<testsuites>
<testsuite errors="0" failures="0" name="my test suite" tests="1">
<testcase classname="some.class.name" name="Test1" time="123.345000">
<properties>
<property name="some.property.name" value="some.property.value"/>
</properties>
<system-out>
I am stdout!
</system-out>
Expand Down