Xamarin.UITest is a C# test automation framework that enables testing mobile apps on Android and iOS. Mobile automation is not a piece of cake but Xamarin.UITest aims to provide a suitable abstraction on top of the platform tools to let you focus on what to test. This talk is not only an introduction of framework but also we are going to present its practical aspects, technical details, benefits and disadvantages. I will show a growing process from “0” – when you have only few local tests, to “Hero” – when you run your tests simultaneously and have fully integrated solution into CI/CD pipeline.
2. About me
Volodymyr Kimak
Senior .NET Engineer, Softjourn
7+ years in .NET, 3+ years in Xamarin
Xamarin Certified Mobile Developer (until Feb 2018)
IF .NET User Group co-organiser
3. ● Intro to mobile testing
● How to start?
● Xamarin Test Recorder
● Selectors, Queries, Tests
● Parallelism
● Integration with CI/CD
Agenda
6. Intro to Xamarin.UITest
Using Xamarin.UITest, you can
test:
● Native app
● Hybrid app
Xamarin.UITest - is a UI Acceptance Testing
framework which uses C# and NUnit test engine.
11. Queries Usage example
Input element on the screen:
[AppCompatEditText]id:"userName"
Can be defined as:
● app.Query("userName");
● app.Query(x=>x.Id("userName"));
● app.Query(x=>x.TextField("userName"));
● app.Query(x=>x.Marked("userName"));
● app.Query(x=>x.Class("AppCompatEditText")
.Index(0));
15. One test: 2 platforms basic example
ITodoPageElements _elements;
public TodoPage(IApp app, Platform platform): base(app, platform)
{
if (Platform == Platform.Android)
{
_elements = new DroidTodoPageElements();
}
else if (Platform == Platform.iOS)
{
_elements = new iOSTodoPageElements();
}
}
16. Simple test example
[Test]
public void CreateNewTodoItem()
{
new LoginScreen()
.LoginAsAppUser(UInfo.uname,UInfo.pass);
new TodoScreen()
.TapOnAddButton()
.AddTitle()
.ChooseDate()
.TapCreateButton()
.CheckIfItemIsCreated();
}
26. Advantages
● Frequent and stable releases to Production
● Performance simulation
● Reduces regression testing time and efforts
● Improves mobile application architecture and code quality
27. Disadvantages
● Xamarin.iOS app requires a special build (without a source
code change automation is not possible);
● Difference in platform capabilities;
● Application may not respond;
● Doesn’t support some hardware features;
● No integration with other apps installed on the device
28. Summary
● Choose a test automation tool based on the development toolset;
● Xamarin.UITest is easy to use;
● Don’t think about platform specifics, write tests;
● One test - two platforms, it works;
● Run your mobile tests in parallel using your own device farm or
test cloud;
● CI/CD integration - a must-have for a mobile project