Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automation using XCUITest

Eeb061c8b2816b771920da1b3e7904a3?s=47 Swift India
September 14, 2019

Automation using XCUITest

Presented by Dillip M at Swift Bangalore meet up Chapter #17

Eeb061c8b2816b771920da1b3e7904a3?s=128

Swift India

September 14, 2019
Tweet

Transcript

  1. iOS Native Apps Automation using XCUITest 1 Dilip M, Senior

    QA Engineer, News Technology Services.
  2. Agenda •  Introduction on Mobile Automation •  Automation Tool Comparison:

    Appium Vs XCUITest •  XCUITest & how it works •  XCUITest APIs & iOS Element Hierarchy •  iOS Automation Framework Approach & Design Patterns •  Demo 2
  3. Mobile Automation •  Must for mobile application testing •  Gives

    confidence during frequent mobile app releases •  Reduces Time to market •  Reduces human errors during manual testing Automating on mobile is tricky & challenging •  Platform diversities : Android vs iOS •  Types of mobile apps : Native vs Hybrid vs Mobile-web 3
  4. XCUITest Vs Appium 4 Comparison XCUITest Appium Language support Objective-C

    / Swift Java, Obj-C, JS, PHP, Python, Ruby, C#, Perl, Clojure Record & Playback Records using XCUIElement with Accessibility identifiers & XCUIElementQuey Records using Xpath object identifiers only (slow) Script Design Easy using Swift. Privilege in adding accessibility ID for objects Requires scripting based on availability of objects - adding more lines of code Continuous Integration Supports OS X Server & other CI tools like buddybuild, Jenkins, Circle CI etc Supports CI tools like Jenkins, Travis, Circle CI etc Test Report Inbuilt support provided Customizable Reports are required Speed 12 times faster than appium Very Slow
  5. XCUITest •  Apple’s native UI Testing framework in Xcode • 

    Supports Swift as well as Objective-C •  Tests the UI layer •  Interacts with the app the way an user does •  Cover broader aspects of functionality •  Better at testing integration of larger pieces •  Compliments Unit Testing 5
  6. Pros & Cons of XCUITest •  Fast & Easy to

    maintain •  Mature & Reliable: No more flaky tests •  Apple’s native language support •  Easy CI Integration •  Xcode Test Recorder •  Faster than ‘On-Top-of-It’ Frameworks •  TvOS support 6 •  No Cross-Platform Support •  Limited Programming Language Support Pros Cons
  7. How UI Testing works? 7

  8. XCUITest APIs 8 • XCUIApplication -  A proxy for an

    application under test that can be launched and terminated. • XCUIElement -  A UI element in an application. • XCUIElementQuery -  A query for locating UI elements.
  9. Design Patterns •  Page Object Model (POM) uses fluent interface

    ( implementation of an object-oriented API that aims to provide the most readable code) •  Follows Method chaining 1.  The context is defined through the return value of a called method-self-referential, where the new context is equivalent to the last context. 2.  Self-referential, where the new context is equivalent to the last contest terminated by the return of a void context. 3.  Terminated by the return of a void context. 9 Fluent Page Object Model •  Formerly known as the Journey Pattern •  An approach for writing high quality automated acceptance test (Behaviour Driven Development) 1.  Given 2.  When 3.  Then Screenplay Pattern
  10. UI Test Framework 10 TestData enum Explicit Waits TestClass XCTestCase

    BaseClass AccessibilityIdentifier enum PageObjectClass ElementClass (user actions)
  11. Demo 11

  12. Thank You !!! 12