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

junitxml: add properties node in testsuite level #1454

Merged
merged 1 commit into from Mar 16, 2016

Conversation

Projects
None yet
2 participants
@tareqalayan
Contributor

tareqalayan commented Mar 15, 2016

The commit allow users to add a properties node in testsuite level see
example below:

<testsuite errors="0" failures="0" name="pytest" skips="1" tests="1"
time="11.824">
  <properties>
    <property name="ARCH" value="PPC"/>
    <property name="OS" value="RHEL 7.2"/>
    <property name="TestPlanURL" value="https://url.."/>
    <property name="Automated" value="True"/>
  </properties>
  <testcase classname="git.....>
  </testcase>
</testsuite>

The current situation is that properties node can be added to every
testcase node. However, sometimes we need some global properties that
applies to all testcases and give better description for the testsuite
itself.

@tareqalayan

This comment has been minimized.

Contributor

tareqalayan commented Mar 15, 2016

@nicoddemus
I closed the PR to master,

however i am not sure if this is correct flow.

please point me to the docs where i should mention this feature.

thanks for the comments again.

@tareqalayan tareqalayan force-pushed the tareqalayan:add-global-properties-node branch from dbbd9fb to fd11b56 Mar 15, 2016

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Mar 15, 2016

About the doc, I'm thinking here, just before the warning... also I think it is worth adding that this feature specifically will only be available in 1.10.

v = str(p.getAttribute('value'))
actual[k] = v
assert (len(actual.keys()) == len(expected.keys()))

This comment has been minimized.

@nicoddemus

nicoddemus Mar 15, 2016

Member

No need to check the size and then each item individually, just simply:

assert actual == expected

And let pytest's assertion introspection take care of a good error message for you. 😉

@tareqalayan tareqalayan force-pushed the tareqalayan:add-global-properties-node branch 5 times, most recently from b07658c to 4c2736f Mar 15, 2016

@tareqalayan

This comment has been minimized.

Contributor

tareqalayan commented Mar 15, 2016

@nicoddemus Thank you for the good reviews so far.
please take a look and let me know if i need to change something.

assert True
This will add a property node below the testsuite node to the generated xml:
.. code-block:: xml

This comment has been minimized.

@nicoddemus

nicoddemus Mar 15, 2016

Member

Please add a blank line before this one otherwise this won't show up correctly in the generated HTML

This comment has been minimized.

@tareqalayan

tareqalayan Mar 16, 2016

Contributor

done

If you want to add a properties node in the testsuite level, which may contains properties that are relevant
to all testcases you can use ``LogXML.add_global_properties``
Note that this feature will be available on v2.10.1.

This comment has been minimized.

@nicoddemus

nicoddemus Mar 15, 2016

Member

You may remove this note, it is not necessary because of the versionadded directive above.

This comment has been minimized.

@tareqalayan

tareqalayan Mar 16, 2016

Contributor

done

</properties>
<testcase classname="test_me.TestMe" file="test_me.py" line="16" name="test_foo" time="0.000243663787842"/>
</testsuite>
.. warning::

This comment has been minimized.

@nicoddemus

nicoddemus Mar 15, 2016

Member

Please make a copy this warning to just before the start of the LogXML: add_global_property section. The way it is now gives the impression that the warning is meant just for LogXML: add_global_property only, when in fact it applies also to record_xml_property.

This comment has been minimized.

@tareqalayan

tareqalayan Mar 16, 2016

Contributor

done

junitxml: add properties node in testsuite level
The commit allow users to add a properties node in testsuite level see
example below:

<testsuite errors="0" failures="0" name="pytest" skips="1" tests="1"
time="11.824">
  <properties>
    <property name="ARCH" value="PPC"/>
    <property name="OS" value="RHEL 7.2"/>
    <property name="TestPlanURL" value="https://url.."/>
    <property name="Automated" value="True"/>
  </properties>
  <testcase classname="git.....>
  </testcase>
</testsuite>

The current situation is that properties node can be added to every
testcase node. However, sometimes we need some global properties that
applies to all testcases and give better description for the testsuite
itself.

@tareqalayan tareqalayan force-pushed the tareqalayan:add-global-properties-node branch from 4c2736f to fa6acdc Mar 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment