Since record_property is incompatible with the xunit2 family, we should add a fixture or some mechanism to do something similar with the supported trait tag.
Especially now that xunit2 is the default family with the 6.0 release, it would be a useful addition.
Example usage
def test(record_trait):
record_trait("key", "value")
Example output in testcase node
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite errors="0" failures="0" hostname="scoria" name="pytest" skipped="0" tests="1" time="4.497"
timestamp="2020-07-24T10:09:52.287953">
<testcase classname="test_example.TestExample" name="test_a" time="4.497">
<traits>
<trait name="key" value="value"/>
</traits>
</testcase>
</testsuite>
</testsuites>
if traits behave the same as properties in junit1, then we should just use the new nodes on the new version
if traits behave the same as properties in junit1, then we should just use the new nodes on the new version
That would be lovely, and much nicer for downstream plugins... for example https://github.com/HypothesisWorks/hypothesis/issues/1975 would just be solved :smile:
if traits behave the same as properties in junit1, then we should just use the new nodes on the new version
Agreed, and it is trivial to implement: 73172b88d21e0e07757844ceaaae897444cae706
I didn't open a PR just because I couldn't find a schema for that version (TBH I didn't spend too much time searching because I'm short on time now). @maspe36 do you happen to have one handy?
Just took another look at this, is xunit2 the same as xunit.net v2? I found a link to a supposed full schema here https://github.com/pytest-dev/pytest/issues/7537 but this schema has properties/property in it instead of traits/trait馃槙
Junit and xunit seem to be distinct
So if that schema is the correct xunit2 schema, why are we warning when using record_property?
good question ,at first glance it seems the "Junit" plugin maintains a number of xunit versions and no junit versions
Our current schema comes from Jenkins:
Oops, yup. Looks like this was my mistake - I got the schemas confused. After looking at the linked schema, it seems that you can only add properties under the testsuite tags and traits is something _specific_ for xunit.net v2 as it is missing from the junit schema. Interesting that the support for properties or some kind of key/value pair for testcases was removed.
Closing for now as the feature request doesn't match the junit schema.
Hmm bummer, but thanks @maspe36 for the follow up!
Most helpful comment
Agreed, and it is trivial to implement: 73172b88d21e0e07757844ceaaae897444cae706
I didn't open a PR just because I couldn't find a schema for that version (TBH I didn't spend too much time searching because I'm short on time now). @maspe36 do you happen to have one handy?