testfx icon indicating copy to clipboard operation
testfx copied to clipboard

TrxReport keeps all test nodes in memory

Open Youssef1313 opened this issue 7 months ago • 3 comments

We keep a list of TestNodeUpdateMessage in memory for TrxReport to generate the report at the end of the test run.

I wonder if we can write to file stream as we get the info and whether it improves Trx perf.

Youssef1313 avatar Jun 14 '25 06:06 Youssef1313

Do you have links to how that is happening? I thought we already write to the file directly, to be more resilient to crash when running the logger in process.

nohwnd avatar Jun 16 '25 07:06 nohwnd

@nohwnd We keep collecting the test nodes in memory here:

https://github.com/microsoft/testfx/blob/85128834dc5707bd3f92ddbeeb77bcc4f9fae300/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs#L42

Then only in OnTestSessionFinishingAsync we will start do something with them.

https://github.com/microsoft/testfx/blob/85128834dc5707bd3f92ddbeeb77bcc4f9fae300/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs#L229-L232

Youssef1313 avatar Jun 16 '25 07:06 Youssef1313

👍 thx, I thought it is more clever. It would be nice to experiment with a way to write directly to file, and how performant it would be. Especially if the report needs some closing string.

OR at least we could start by writing a file for the report with a failure, and then collect in memory, and then re-write the file. So we get at least a generic failure result when the process crashes and fails to write anything.

nohwnd avatar Jun 16 '25 07:06 nohwnd