-
Notifications
You must be signed in to change notification settings - Fork 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
How to get testcases properties? #116
Comments
Have you tried this? https://github.com/weiwei/junitparser#handling-custom-xml-attributes |
Looks like Which flavour of XML dialect are you having there? Which tool generates this? |
I'm generating it with gtest.
In gtest you can attach extra properties to a test case and they are added
to the junit file.
…On Thu, 19 Oct 2023, 14:43 Enrico Minack, ***@***.***> wrote:
Looks like TestSuite has properties(), which provides access to
properties of the suite, but TestCase does not have this. Should be easy
to access this to TestCase, or your own derivative of TestCase.
Which flavour of XML dialect are you having there? Which tool generates
this?
—
Reply to this email directly, view it on GitHub
<#116 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGB6YTAOL2JA5TY3JSNQ3UDYAEVBDAVCNFSM6AAAAAA6HA5BDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGAYTSOJVGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The use case is that we need to keep track of some values during the tests
and then if they succeeded graph it out the values
…On Fri, 20 Oct 2023, 07:38 nick83ola, ***@***.***> wrote:
I'm generating it with gtest.
In gtest you can attach extra properties to a test case and they are added
to the junit file.
On Thu, 19 Oct 2023, 14:43 Enrico Minack, ***@***.***>
wrote:
> Looks like TestSuite has properties(), which provides access to
> properties of the suite, but TestCase does not have this. Should be easy
> to access this to TestCase, or your own derivative of TestCase.
>
> Which flavour of XML dialect are you having there? Which tool generates
> this?
>
> —
> Reply to this email directly, view it on GitHub
> <#116 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AGB6YTAOL2JA5TY3JSNQ3UDYAEVBDAVCNFSM6AAAAAA6HA5BDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGAYTSOJVGE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Hi @nicola-lunghi, please check the example at https://github.com/weiwei/junitparser#handling-xml-with-custom-element to see if it helps. |
Hi, |
Hello to everyone reading this, I found a solution for this problem. As you know, you can add custom properties to JUnit XML using Pytest's
The above fixture will add the The output JUnit XML file will contain these properties like so:
To extract these properties with
Now to iterate over the properties, you need to iterate over the custom elements of the test case using
If you're using @weiwei Despite the workaround, since properties is a feature supported by many platforms, I suggest adding support for this in |
@nicola-lunghi @ZioTino Please see my solution above. |
@gilmatok If it's from pytest then we have a "flavor" for it in https://github.com/weiwei/junitparser/blob/master/junitparser/xunit2.py which is supposed to fully support pytest. I think it'll be fine to add it over there. Care to submit a PR? |
I have the following xml
I need to extract the test properties there's a way to do it?
thanks,
Nicola
The text was updated successfully, but these errors were encountered: