Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
What to Upload to SlideShare
Loading in …3
×
1 of 29

Mobile testing. Xamarin.UITest approach

0

Share

Download to read offline

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.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Mobile testing. Xamarin.UITest approach

  1. 1. Mobile testing. Xamarin.UITest approach
  2. 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. 3. ● Intro to mobile testing ● How to start? ● Xamarin Test Recorder ● Selectors, Queries, Tests ● Parallelism ● Integration with CI/CD Agenda
  4. 4. Mobile automation
  5. 5. Why Xamarin.UITest?
  6. 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.
  7. 7. How to start?
  8. 8. Recording example in MacOS Xamarin Test Recorder
  9. 9. ● Tap ● Scroll ● Swipe ● Pinch ● EnterText ● ClearText ● Back ● Query ● WaitFor(No)Element Commands
  10. 10. Queries ● Id ● Class ● Text ● Button ● Property ● Marked ● XPath ● Css ● etc...
  11. 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));
  12. 12. app.WaitForElement(c=>c.Marked("OpenNewTab")); app.Tap(c=>c.Marked("OpenNewTab")); app.ClearText( c=> c.Id("noteInput")); app.EnterText( c=> c.Id("noteInput"), "note"); app.ScrollDown(); app.ScrollDownTo(c => c.Id("menu")); Commands Usage example
  13. 13. Android base configuration IApp app = ConfigureApp .Android .ApkFile("/path/to/android.apk") .StartApp(); App Initializing iOS base configuration IApp app = ConfigureApp .iOS .AppBundle("/path/to/iosapp.app") .StartApp();
  14. 14. REPL (read-eval-print-loop) Usage in test code: app.Repl();
  15. 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. 16. Simple test example [Test] public void CreateNewTodoItem() { new LoginScreen() .LoginAsAppUser(UInfo.uname,UInfo.pass); new TodoScreen() .TapOnAddButton() .AddTitle() .ChooseDate() .TapCreateButton() .CheckIfItemIsCreated(); }
  17. 17. Test project structure Before After
  18. 18. Approaches Parallelism ▪ On-premises - nUnit2 + CI - nUnit3 (+ CI) ▪ Cloud based (Visual Studio App Center Test)
  19. 19. CI/CD Pipeline solutions ▪ TeamCity ▪ VSTS ▪ Visual Studio App Center
  20. 20. CI steps: mobile app (VSTS)
  21. 21. CI steps: UI tests (VSTS)
  22. 22. CD steps: run tests pipeline (VSTS)
  23. 23. CD steps: environment tasks (VSTS)
  24. 24. Test run result (Visual Studio App Center)
  25. 25. Test run result (Visual Studio App Center)
  26. 26. Advantages ● Frequent and stable releases to Production ● Performance simulation ● Reduces regression testing time and efforts ● Improves mobile application architecture and code quality
  27. 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. 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
  29. 29. Questions? or ask later: vova.kimak

×