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

UI Automation in iOS Apps

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

UI Automation in iOS Apps

Automating iOS Application using Xcode UI tests

Avatar for Andrey Kozlov

Andrey Kozlov

September 08, 2017

Other Decks in Programming

Transcript

  1. Agenda • Why Automation Testing? • Tooling • Problems •

    Approach • Mocking and Stubbing • Analytics testing • Next steps
  2. Why Automaton Testing • Help QA team to reduce regression

    testing • Increase Application Quality • Increase confidence • Faster feedback on changes. • Catch issues earlier in a process • Bigger test coverage • Automated way of testing • RSP accreditation
  3. Right tool for a job? • KIF • Calabash •

    Frank • Appium • Apple Xcode UI Tests
  4. Why Apple Xcode UI Tests? • Native tool • More

    stable • Apple support and updates • Improves along with platform • Same development language as for main App • Familiar environment for Developers • Good documentation • It works!
  5. Problems? • Speed • Maintainability and Reusability • Reliability •

    Still UnitTest type of tests. • All team involvement including QA team
  6. Testing Framework • Abstraction for element matching • Simplified way

    of writing test scenarios • BDD-ish style of tests • Alert handling • Custom checks and Assertions • Custom methods of interaction with elements • Navigation between screens • Integrated Stubbing • e.t.c.
  7. Example func testLoginWithCorrectDetails() { let loginScreen = GivenApplicationIsOn(LeisureLoginScreen()) WhenUserEntersText("[email protected]", into:

    loginScreen.emailTextField) WhenUserEntersText("password", into: loginScreen.passwordTextField) WhenUserTaps(on: loginScreen.loginButton) ThenLabelShouldExist("Account") } Login Scenario
  8. Example func testBuyingSingleJourneyWithMultiplePassengersMultipleRailcards() { GivenApplicationIsOn(PlanAndBuySearchScreen()) let journey = StubJourney(origin: "YRK",

    destination: "NCL").setType(.single).setAdults(3).setRailcards(["16-25 Railcard","JobCentrePlus Discount Card"]) WhenUserSearchTrains(journey: journey, on: PlanAndBuySearchScreen()) ThenUserShouldBeOnScreen(JourneyResultsScreen()) ThenLabelShouldExist("Valid railcards savings applied") WhenUserNavigate(to: PaymentSummaryScreen()) ThenLabelShouldExist("JobCentrePlus Discount Card, 16-25 Railcard discounts applied") WhenUserNavigate(to: AddPaymentCardScreen()) WhenUserEnterCardDetails(on: AddPaymentCardScreen(), cardName: .VisaCredit, email: "[email protected]") ThenUserShouldBeOnScreen(PaymentSummaryScreen()) WhenUserEntersText("111", into: PaymentSummaryScreen().cvvTextField) WhenUserTaps(on: PaymentSummaryScreen().payByCardButton) ThenUserShouldBeOnScreen(MyTicketsScreen(), timeout: 20.0) } Making purchase and check booking is there
  9. Configuration • Using Xcode Schemes to organise tests in bundles

    • Use of Environment variables to communicate with Application under Test • Stubbing Feature toggles using using Environment variables • Using low level xcodebuild command for more flexible test selection • Passing Stubbing service URL and GUID
  10. What is next? • Open sourcing • Update to use

    Swift 4 and Xcode 9 features • Release Framework and Stubbing Service Template in Swift • Implement toolset to help with UI Automation for iOS