question

StephenMulryan-5232 avatar image
0 Votes"
StephenMulryan-5232 asked NicoleLu-9366 answered

Xamarin.UITest - Marked

Hi,

I am writing automation tests using Xamarin.UITest. I have started adding Automation Ids to the Xaml files of the Xamarin project. I am wondering if there is increased efficiency in the tests by using Automation Id's over the Text within the UI Element?

What I have tried to figure out is if there is a order in which the Marked method performs a search of the UI tree. I decompiled the Xamarin.UITest to see what was specified in the Queries.Marked method.

It states in the method what it searches for on Android and iOS but it's not clear to me how this is achieved.

Has anyone got any knowledge on this?

79669-marked.png

Furthermore I have tried using the Id method to locate the element instead of Marked but it doesn't seem to work. When viewing the elements on Android using App.Repl() it seems that the AutomationId translates to the Label property.


dotnet-xamarin
marked.png (31.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

NicoleLu-9366 avatar image
0 Votes"
NicoleLu-9366 answered

Hi @StephenMulryan-5232, referring to UITest doc

When writing UITests, the AutomationId value is exposed differently on each platform:
iOS uses the id field.
Android uses the label field.

It's suggested to use the Marked test query to write cross-platform.

For how the Marked method is implemented, since UITest now belongs to AppCenter team, you can ask for more details in AppCenter support(in AppCenter portal) or in App Center github


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.