O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mobile Test Automation with Appium

Book Description

Automate your mobile app testing

About This Book

  • How to automate testing with Appium

  • Apply techniques for creating comprehensive tests

  • How to test on physical devices or emulators

  • Who This Book Is For

    Are you a mobile developer or a software tester who wishes to use Appium for your test automation? If so, then this is the right book for you .You must have basic Java programming knowledge. You don't need to have prior knowledge of Appium.

    What You Will Learn

  • Discover Appium and how to set up an automation framework for mobile testing

  • Understand desired capabilities and learn to find element locators

  • Learn to automate gestures and synchronize tests using Appium

  • Take an incremental approach to implement page object pattern

  • Learn to run Appium tests on emulators or physical devices

  • Set up Jenkins to run mobile automation tests by easy to learn steps

  • Discover tips and tricks to record video of test execution, inter app automation concepts

  • Learn to run Appium tests in parallel on multiple devices simultaneously

  • In Detail

    Appium is an open source test automation framework for mobile applications. It allows you to test all three types of mobile applications: native, hybrid, and mobile web. It allows you to run the automated tests on actual devices, emulators, and simulators. Today, when every mobile app is made on at least two platforms, iOS and Android, you need a tool that allows you to test across platforms.

    Having two different frameworks for the same app increases the cost of the product and time to maintain it as well. Appium helps save this cost.

    With mobile app growth exploding, mobile app automation is mainstream now. In this book, author Nishant Verma provides you with a firm grounding in the concepts of Appium while diving into how to set up appium & Cucumber-jvm test automation framework, implement page object design pattern, automate gestures, test execution on emulators and physical devices, and implement continuous integration with Jenkins. The mobile app we have referenced in this book is Quikr because of its relatively lower learning curve to understand the application. It's a local classifieds shopping app.

    Style and approach

    This book takes a practical, step-by-step approach to testing and automating individual apps such as native, hybrid, and mobile web apps using different examples.

    Table of Contents

    1. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    2. Introduction to Appium
      1. Native app
      2. Mobile Web app
      3. Hybrid app
      4. Appium architecture
        1. XCUITest
          1. UiAutomator 2
          2. Pros of using Appium
      5. Summary
    3. Setting Up the Machine
      1. Machine setup for macOS
        1. Installing Java
        2. Installing Android SDK (using the Android command-line tool)
        3. Installing Android SDK (using Homebrew) (Optional)
        4. Creating Android Virtual Device (Optional)
        5. Genymotion emulator
          1. Debug help
        6. Installing Appium
        7. Installing Appium server (From Source) (Optional)
        8. Selecting IDE
          1. App under test
      2. Machine setup for Windows
        1. Installing Java
        2. Installing Android SDK (using Android command-line tool)
        3. Installing Node JS
        4. Installing Appium
          1. Installing Appium server (via npm)
        5. Installing Genymotion
        6. Selecting IDE
      3. Appium GUI app
      4. Summary
    4. Writing Your First Appium Test
      1. Creating an Appium Java project (using gradle)
      2. Introduction to Cucumber
      3. Writing our first Appium test
        1. Running the feature file
        2. Refactoring
        3. Implementing the remaining steps
        4. Running the scenario
        5. Automating a mobile web app using Appium
        6. Implementing the remaining steps
        7. Automating the iOS app using Appium
          1. Build the app
          2. Deploying the app on the iOS Simulator
            1. Via xcrun command
            2. Using Appium
          3. Generating Boilerplate code for iOS
      4. Summary
    5. Understanding Desired Capabilities
      1. Refactoring -1
      2. Server argument
        1. Refactoring -2
      3. Server capabilities
        1. Refactoring -3
      4. Android-only capabilities
        1. Refactoring -4
      5. iOS-only capabilities
      6. Summary
    6. Understanding Appium Inspector to Find Locators
      1. Appium inspector
        1. Implementing the other steps
        2. UI Automator Viewer
        3. Debugging mobile web apps using Chrome Inspect
      2. Summary
    7. How to Synchronize Tests
      1. AppiumDriver
      2. Implicit wait
      3. Explicit wait
      4. Fluent wait
      5. Summary
    8. How to Automate Gestures
      1. Gestures
        1. TouchAction
        2. MultiTouch
        3. Scroll
        4. Swipe
        5. Orientation
      2. Summary
    9. Design Patterns in Test Automation
      1. Refactor -1
      2. Page Object pattern
        1. Refactor-2
        2. Assertions
          1. Implementing assertions in Page Object
          2. Implementing assertion in test script
          3. Avoiding dependencies between tests
          4. Introducing set up and tear down
      3. Summary
    10. How to Run Appium Test on Devices and Emulators
      1. Emulator
        1. Running test on the Genymotion emulator
      2. Devices
        1. Running a test on actual Android devices
        2. Running a test on actual iOS devices
      3. Summary
    11. Continuous Integration with Jenkins
      1. Refactoring -1
      2. Setting up Jenkins
        1. Moving a project to Git
        2. Adding Jenkins plugin
        3. Setting up the Jenkins task
        4. Viewing reports in Jenkins
      3. Summary
    12. Appium Tips and Tricks
      1. Switching between views - web and native
      2. Taking screenshots
      3. Recording video execution
      4. Interacting with another app
      5. Running the test in parallel
      6. Network conditioning
      7. Summary
    13. Appium Desktop App
      1. Installing the new Appium app
        1. Starting a simple server
          1. Start New Session
          2. Attach to an existing session
        2. Desired Capabilities
        3. Appium Inspector
        4. Starting the server with advanced options
        5. Appium Endpoints
      2. Summary
    14. Appendix
      1. Introduction to Cucumber
        1. How does Cucumber work?
          1. Feature
          2. Scenario
          3. Background
          4. Scenario Outline
          5. Hooks in Cucumber
        2. Running Cucumber
          1. CLI Runner
          2. JUnit Runner
          3. Third-Party Runner (Via IntelliJ)
      2. Finding an app's package name and launch activity
        1. Using the ManifestViewer app
        2. Using the Appium GUI app
      3. Installing Google Play services in the Genymotion emulator
      4. Summary