Skip to content

Fixes #5126 TestResult.*Counts#5127

Merged
OsirisTerje merged 6 commits intonunit:mainfrom
maettu-this:5126_TotalCount
Feb 19, 2026
Merged

Fixes #5126 TestResult.*Counts#5127
OsirisTerje merged 6 commits intonunit:mainfrom
maettu-this:5126_TotalCount

Conversation

@maettu-this
Copy link
Copy Markdown
Contributor

@maettu-this maettu-this commented Feb 17, 2026

  • Some minor cleanup
  • Documentation of *Counts refined
  • InitiatedCount and CompletedCount added

Feel free to merge/cherry-pick/reject as feasible.

Fixes #5126

@maettu-this
Copy link
Copy Markdown
Contributor Author

Note that the order of the Fail/Warn/Pass properties differs among ITestResult/TestResult/TestSuiteResult and TestResult*Tests, for the latter the order is Pass/Fail/Warn. Either let me know whether I shall clean this along with this PR, or fix it when merging.

@OsirisTerje
Copy link
Copy Markdown
Member

OsirisTerje commented Feb 17, 2026

@maettu-this Thanks for this! Looks good.

Just do the cleaning in this PR.

Also, from my comments, would be nice if you also elaborated on this in the documentation, ref my links there.

@nunit/framework-team Let me merge this PR, I am in the middle of a release. :-)

@maettu-this
Copy link
Copy Markdown
Contributor Author

Just do the cleaning in this PR.

Which way around does the team prefer the order?

  • Total/Fail/Warn/Pass? (From bad to good. This is the current order in TestResult)
  • Total/Pass/Fail/Warn? (The natural order? This is the current order in e.g. TestResult.xsd which I have have just now realized needs to be extended as well)
  • Total/Pass/Warn/Fail? (From good to bad. This is my personal favorite.)

@OsirisTerje
Copy link
Copy Markdown
Member

OsirisTerje commented Feb 18, 2026

Which way around does the team prefer the order?

I am not so concerned about the order, so any way is fine by me. This is just source code, so.

Also be aware that some tools order fields and properties alphabetically. Use of such tools on this code would change "the order".

If order matters somehow somewhere it would be in the generated XML, there it might help for those few that read it, to see them in a meaningful way. Your suggested order is fine by me there.

@maettu-this
Copy link
Copy Markdown
Contributor Author

Changes to XSD/XML now pass CI.

@maettu-this
Copy link
Copy Markdown
Contributor Author

Looking at the different orders in detail, I came to the conclusion to make the least intrusive cleanup by following the order in the Assert class implementation: Pass - Fail - Warn - Ignore/Skip - Inconclusive.

Cleanup passes CI as well => @OsirisTerje the PR is ready to be reviewed.

Copy link
Copy Markdown
Member

@OsirisTerje OsirisTerje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that there are no breaking changes.
It is a bit hard to review now since the "order" have changed.

/// Gets the number of test cases that got initiated
/// when running the test and all its children.
/// </summary>
int AssertCount
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems you have renamed this ?
Existing methods in the interface have to be there, so that we avoid breaking changes.

It can just redirect to the new one, with a comment it is legacy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reorderig commit 4fc7e8a shows how PassCount and AssertCount got "moved" to the matching location.

/// Gets the number of test cases that have completed
/// when running the test and all its children.
/// </summary>
int PassCount
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment above, it has to stay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reorderig commit 4fc7e8a shows how PassCount and AssertCount got "moved" to the matching location.

/// Gets the number of test cases that got initiated
/// when running the test and all its children.
/// </summary>
public abstract int TotalCount { get; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has this been removed? Note: No breaking changes, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last reorderig commit 4fc7e8a shows how the counts got "moved" to the matching location.

@maettu-this
Copy link
Copy Markdown
Contributor Author

@OsirisTerje please see the individual https://github.com/nunit/nunit/pull/5127/commits:

  1. Review all the way through the second last commit, no breaking changes, just the two new added counts.
  2. Review the last commit, no breaking changes either, just the reordering where orders mismatched.

@OsirisTerje OsirisTerje merged commit 36c0ecd into nunit:main Feb 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ITestResult.TotalCount does not seem to behave as specified

2 participants