unoplatform / uno.ui.runtimetests.engine

In-App MS Tests Runner for Uno Platform and WinAppSDK
https://platform.uno/
Other
7 stars 3 forks source link

QoL: Add additional info/context for test failure message #88

Open Xiaoy312 opened 1 year ago

Xiaoy312 commented 1 year ago

What would you like to be added:

Some way to writing to a string buffer that will be included when the test fail. This message should be included in the ci error report and in the output area of the test runner.

Why is this needed:

This could be used to add additional info/context for debugging. Also, it is annoying to add message with full context to every assert method.

For which Platform: All of them

Anything else we need to know?

Sort of what is done in unoplatform/uno#2804, but from the test impl side. SO answer says that we could use Trace.WriteLine(). To validate if this will appear on ci. If so, we could add listener to it to pipe to the test runner's output area.

Xiaoy312 commented 1 year ago

AssertionScope is what we needed: https://github.com/unoplatform/uno/blob/release/stable/4.8/src/SamplesApp/SamplesApp.UITests/TestFramework/ImageAssert.cs#L115-L118

more examples: https://github.com/fluentassertions/fluentassertions/blob/master/Tests/FluentAssertions.Specs/Execution/AssertionScopeSpecs.cs