testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Only track last status / Allow overridding test status

Open thomhurst opened this issue 2 months ago • 2 comments

This is what someone has said they want from a testing suite:

for things like acceptance tests - I may have 10 tests in a fixture, if 9 of them pass maybe I view that as a 'pass' - from a business process perspective the 1 failure is acceptable (eg I have 10 product lines, 1 of them failing means I still release, just disable that one and fix as a hotfix)

If I wanted to support this currently, I'd have to hold back from sending status updates to the message bus, and only send them when the tests are all finished - Which is a hacky workaround and also detrimental to the UX.

If I send a "Failed" update for a test node, but then after send a "Passed" update for that same test node, MTP still reports a failure at the end. It also messes up the test counts because I don't think MTP checks that the test was already reported or not, it just increments some basic counter.

This means a framework can't change its decision about a test. Which sounds weird, but there are use cases where users have specific needs.

I think MTP should maintain a dictionary of ConcurrentDictionary<TestNodeUid, TestNodeStatusProperty> - And when receiving new statuses, just overwrite what's currently in the dictionary. This would give proper counts (just count the dictionary entries at the end) and allow statuses to be overridden.

What do you guys think?

thomhurst avatar Oct 31 '25 11:10 thomhurst

I'm not sure this is the best design. The given scenario probably needs a different approach. Marking as Needs: Design for now. We would also need to get more user feedback on this.

Maybe what would be the best approach here is to allow the test framework to hook into the logic of https://github.com/microsoft/testfx/blob/52cee02a2016c32840cf187e0f631306d77628c2/src/Platform/Microsoft.Testing.Platform/Services/TestApplicationResult.cs#L89

Youssef1313 avatar Oct 31 '25 12:10 Youssef1313

We need to also think about this for CI scenarios. For example, if you publish TRX files to AzDO, how can that information be surfaced correctly there so that the task fails/succeeds correctly.

Youssef1313 avatar Oct 31 '25 12:10 Youssef1313