bojingo
bojingo

Reputation: 592

Outputting Xamarin.UITest REPL tree to failed test results

I am trying to make my Xamarin.UITest output clearer and easier to work with. Every so often when Xamarin Forms updates the tree changes in subtle ways that break our UITests. Also, when developing a test it isn't always necessarily clear what the query should look like to get to a view element we want our test to interact with.

To address these, when a test fails with an "Unable to find element" error, I want to capture the app's view tree and output it to the test results.

Currently in these cases we have to modify the test code by adding app.Repl(); (see Working With the REPL), re-run the test, wait for the REPL window to appear, type tree, look at the output, type exit to leave the REPL, make my code changes based on what I saw in the tree command's output, and rinse-repeat until I have a working test. Instead, if the test results contains the outputs of the REPL's tree command, I can start making changes to fix the test code immediately and greatly speed up my testing feedback loop.

How could I most easily achieve this?

Upvotes: 1

Views: 695

Answers (1)

Vu_Ng
Vu_Ng

Reputation: 48

app.Print.Tree();

I think this is what you searched for.

Upvotes: 3

Related Questions