Repository navigation
Labels
Milestone
Description
We have a base TrxMessage with 3 concrete implementations:
- StandardErrorTrxMessage (should go to StdErr, and correctly does)
- StandardOutputTrxMessage (should go to StdOut, and correctly does)
- DebugOrTraceTrxMessage (should go to DebugTrace, but incorrectly goes to StdOut today)
Then if we face an instance that's not any of the 3 concrete implementations (e.g, another implementation provided by user, of an instance of the base TrxMessage directly), we add it to StdOut. It feels like in v2 we should consider doing a break here if Trx is really designed to deal with StdError, StdOut, and DebugTrace only. We don't need a base type here.
Implementation on MTP:
testfx/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs
Lines 484 to 495 in 6a685fa
| TrxMessagesProperty? trxMessages = testNode.Properties.SingleOrDefault<TrxMessagesProperty>(); | |
| IEnumerable<string?>? nonErrorMessages = trxMessages?.Messages.Where(x => x is not StandardErrorTrxMessage).Select(x => x.Message); | |
| if (nonErrorMessages?.Any() == true) | |
| { | |
| output.Add(new XElement("StdOut", RemoveInvalidXmlChar(string.Join(Environment.NewLine, nonErrorMessages)))); | |
| } | |
| IEnumerable<string?>? errorMessages = trxMessages?.Messages.Where(x => x is StandardErrorTrxMessage).Select(x => x.Message); | |
| if (errorMessages?.Any() == true) | |
| { | |
| output.Add(new XElement("StdErr", RemoveInvalidXmlChar(string.Join(Environment.NewLine, errorMessages)))); | |
| } |
Relevant part on VSTest:
Reacted by Amaury Levé and Jakub Jareš
Activity