An open API service indexing awesome lists of open source software.

https://github.com/thecodetraveler/androidcheckboxsampleapp

A simple app to demonstrate how to interact with an Android CheckBox from a UITest
https://github.com/thecodetraveler/androidcheckboxsampleapp

Last synced: about 1 year ago
JSON representation

A simple app to demonstrate how to interact with an Android CheckBox from a UITest

Awesome Lists containing this project

README

          

# AndroidCheckBoxSampleApp
This is a simple app to demonstrate how to interact with an Android CheckBox from a UITest.

To interact with an Android CheckBox from a UITest, you must use the [Invoke](https://docs.microsoft.com/dotnet/api/xamarin.uitest.queries.appquery.invoke?view=xamarin-uitest-sdk&WT.mc_id=mobile-0000-bramin#Xamarin_UITest_Queries_AppQuery_Invoke_System_String_) method to access the methods in the [native Java Android API](https://developer.android.com/reference/android/widget/CheckBox.html). In our `Invoke` statements, we can take advantage of `performClick()` to toggle the CheckBox, `setChecked(boolean checked)` to set the value of the CheckBox, and `isChecked()` to return a bool that is `true` when the CheckBox is checked and `false` when it is unchecked.

In the UITest project, I created a [ToggleCheckBox](https://github.com/brminnick/AndroidCheckBoxSampleApp/blob/master/CheckBoxSampleApp.UITest/Tests.cs#L128) method to toggle an individual CheckBox, a [IsCheckBoxChecked](https://github.com/brminnick/AndroidCheckBoxSampleApp/blob/master/CheckBoxSampleApp.UITest/Tests.cs#L134) method to return the CheckBox current status, and a [SetCheckBox](https://github.com/brminnick/AndroidCheckBoxSampleApp/blob/master/CheckBoxSampleApp.UITest/Tests.cs#L139) method to set the CheckBox status.