-
Notifications
You must be signed in to change notification settings - Fork 724
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
Finalize XML Format for Test Results #254
Comments
Maybe we should not use attributes at all. If already now we are not sure whether to use one or two, we better use child tags. If a test has an attribute result="Success" it's senseless to additionally state executed="True". If it has a result, it must have been executed. Maybe something like this:
|
We don't actually have an executed="True" attribute in the NUnit 3.0 XML I made the notation about "one label or two" to remind myself to write it An NUnit 3.0 ResultState has two components, called Status and Label. The options I was considering, regarding two versus one attributes were:
There are a discrete set of values possible for ResultState internally, but On Mon, Oct 6, 2014 at 8:29 AM, Peter Brightman notifications@github.com
|
We don't actually have an executed="True" attribute in the NUnit 3.0 XML I made the notation about "one label or two" to remind myself to write it An NUnit 3.0 ResultState has two components, called Status and Label. The options I was considering, regarding two versus one attributes were:
There are a discrete set of values possible for ResultState internally, but For a more OO approach, having a single result field using the colon format However, I suspect it's easier to find everything that failed, for whatever I'd especially like opinions from folks who actually like to work with XML, Charlie On Mon, Oct 6, 2014 at 8:29 AM, Peter Brightman notifications@github.com
|
So "executed" as well as "success" is no more part of 3.0, right? |
OK, I take your point. So, if we follow that direction, each test will have Because of some ongoing work, not yet merged, there will also be an Selecting all failed tests will simply use the result attribute, but Does that make sense? On Tue, Oct 7, 2014 at 1:49 AM, Peter Brightman notifications@github.com
|
Yes, it does make sense. As said before, to KIS it's better to avoid extracting substrings on values that indeed hold two values, separated by a colon. To test for an absent attribute is also easy by using the not keyword eg. "test-case/[@Result='Failed']][not(@Label)] finds all failed test-cases that have no label attribute. Of course xpath can be used with the label attribute in first case, but if a value for attribute label can occurr on different values of result, in this case of course both attributes have to be examined. And if there is a third attribute called site (as you have mentioned) it has to be considered within the xpath expression as well. Of course values of attributes can be ORed together in a predicate so something like "test-case/[@Result='Inconclusive' or @Result='Skipped']] can also make sense, depending on the report desired. If i want to know how many TearDowns have failed i'd use "count(./test-case[@Result='Failed'][@site='TearDown'])". We should fulfill the SRP, an attribute classifies a certain thing e. g. resultstate. A label should use a separate attribute, a site classification too. |
Pragmatically speaking, that makes sense and I'm thinking its the way to But it sounds like three attributes will work better.
|
I'm working on documenting the current state of the XML format. See https://github.com/nunit/nunit/wiki/Test-Result-XML-Format I see one issue with the It shows up as a child of the Additionally, if we once add a feature of running tests in another machine, many more of these values could potentially vary. Ideas about how to deal with this are sought! |
The description of the result file is complete at https://github.com/nunit/nunit/wiki/Test-Result-XML-Format and needs a review. @yetibrain @rprouse Would you take a look? I'm planning to change the text content of the output, message and stack-trace elements to CDATA sections. For attributes that have values provided or influenced by the user, I'm going to add code to replace any invalid XML characters, which will deal with issue #850 as well. |
Hi Charlie,
As you had suggested, moving some of the attributes to the "assembly" makes more sense as 'runtime versions' make more sense with the I do not want to suggest anything that may cause a rework but uncluttering the XML format more, will increase the readability, cleanliness of the resultant XML file, and may also help refactor the design. Please ignore these below suggestions if they mean reworking the code and not refactoring the design. SRP and DRY
The output for your ready reference:
as does the attribute total at the root level. The output for your ready reference: Instead of testcasecount appearing as an attribute of |
Please let me clarify one thing: all changes to the format are programming changes. We have been producing XML output from NUnit 3.0 alphas and betas for a number of years. That's how we work. However, code is not steel and concrete. It can be changed if there is a reason to change it. For your specific comments: The asserts on a suite are equal to the number of asserts executed in all the test cases plus any asserts executed in the suite's OneTimeSetUp. The testcasecount is the number of test cases found in a suite or assembly while the total is the number of test cases selected for execution. If no filter is used, then the values are the same, but they can easily be different. I added info to the document explaining these points. |
This comment will serve as a ToDo list of changes for completing the issue. I'll edit it as we go.
|
There will need to be future work on the environment element. I created issue #887 for that. |
Executor now doesnt warn on missing RANDOM_SEED file nunit#253
Get comments from the community.
Specific issues:
The text was updated successfully, but these errors were encountered: