You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a framework author would have to know about a specific traits key that needs adding to the PropertyBag - Leaking internal testing platform implementation details and could be easily missed or unknown. This could be abstracted away behind a custom property object.
Authors would also need to know how Categories are defined vs Traits. (Seems to be the category is a key with no value, and a trait is a key value pair)
SerializableNamedKeyValuePairsStringProperty which the VSTest bridge uses is internal, so framework authors don't have the option of using that.
Even without this, there is still the issue they the underlying property type is internal. I think this is blocking framework authors from setting traits/categories unless there's a workaround?
Marking as bug although I don't have time to test/investigate right now. We should have supprot for traits/properties/metadata as it's a heavily used feature in VS.
Good news, I was doing some checks and tests about this and found out we already implemented TestMetadataProperty, it's public and it's already plugged into the communication protocol for Test Explorer.
I'll close as done but please if there are any bug please reopen/comment.
// Key value pairs of traits. Traits have name and value. Frameworks that only support categories,
// can leave the value null, or empty.
// Example: "traits": [{ "trait1": "traitValue1"}, {"trait2": "traitValue2" }, { "category1": null }]
'traits': Trait[];
Activity
thomhurst commentedon Nov 7, 2024
Even without this, there is still the issue they the underlying property type is internal. I think this is blocking framework authors from setting traits/categories unless there's a workaround?
Evangelink commentedon Nov 11, 2024
Marking as bug although I don't have time to test/investigate right now. We should have supprot for traits/properties/metadata as it's a heavily used feature in VS.
Evangelink commentedon Nov 11, 2024
It's probably a better idea that exposing this technical type, let me discuss with the team and get back to you.
[-][Testing Platform] TestTraitsProperty[/-][+]Add traits to a TestNode properties[/+]Evangelink commentedon Nov 11, 2024
Hey Tom Longhurst (@thomhurst),
Good news, I was doing some checks and tests about this and found out we already implemented TestMetadataProperty, it's public and it's already plugged into the communication protocol for Test Explorer.
I'll close as done but please if there are any bug please reopen/comment.
thomhurst commentedon Nov 11, 2024
So for a category do I just add a metadata property with an empty key?
Evangelink commentedon Nov 11, 2024
Null or empty string value, the category is the key. I guess we could provide a different ctor for that!
See https://github.com/microsoft/testfx/blob/main/docs/mstest-runner-protocol/001-protocol-intro.md
thomhurst commentedon Nov 11, 2024
Thanks seems to be working great. Up to you if you want to leave this open to create a simpler constructor 😄