Leanpub Header

Skip to main content

Practical Desktop App Test Automation with Appium

Test Windows desktop apps wisely with Appium

Facebook releases twice a day; LinkedIn pushes out updates several times a day. What do they do in common to achieve that? Comprehensive automated UI testing.

The authors are letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
About

About

About the Book

While few people deny the benefits of test automation, comprehensive automated testing via UI (browser for web applications) is rarely implemented in software projects. Common reasons for projects' failed attempts on test automation are:

  • Difficult to learn - test scripts are complex and testing tools are not easy to use
  • Hard to maintain - UI tests are vulnerable to application changes
  • Long feedback loop - automated tests take too long to run

To succeed in automated testing via UI, software projects need to overcome all these 3 challenges.

This book presents a practical approach to implementing test automation for desktop applications. Topics include:

  • Developing easy to read and maintain Appium tests using a next-generation functional testing tool
  • Page object model
  • Functional Testing Refactorings
  • Setting up a continuous testing server to manage the execution of a large number of automated UI tests

To help readers learn more effectively, the book has a dedicated site containing the following resources:

  • Software. Test automation is not necessarily expensive. All test frameworks featured in this book are free and open-source.
  • Sample test scripts. Ready-to-run test scripts for the exercises in the book.
  • Tutorial screencasts. You will be able to see how exercises are done step by step.

Share this book

Price

Pick Your Price...

Minimum price

$20.00

$30.00

You pay

$30.00

Authors earn

$24.00
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 2)

2
The author will earn $24.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Authors

Zhimin Zhan

Zhimin Zhan is the founder and principal agile testing coach of AgileWay Pty Ltd, Australia. As an advisor and coach, he helps organisations implement test automation using Continuous Testing with open technologies, such as Selenium WebDriver / Appium. Zhimin is the creator of TestWise, the next-generation functional testing tool that supports functional test refactorings, and BuildWise, an international award-winning Continuous Testing Server. Zhimin is a frequent speaker and author of 14 books on software testing and programming. He shares his test automation and CI experience on Substack and Medium.

Courtney Zhan

Courtney Zhan is a Software Development Engineer at Amazon Australia, with a passion for end-to-end test automation, programming, continuous testing, and graphic design. She shares tips and insights on test automation and continuous testing weekly on Medium and Substack. Courtney is the published author of Selenium WebDriver Recipes in C# by Apress, and 21 of her articles have been featured on software testing newsletters.

Contents

Table of Contents

Preface

  1. Who should read this book
  2. How to read this book
  3. Send me feedback

1Introduction

  1. 1.1Test automation benefits
  2. 1.2Test Automation success factors
  3. 1.3Why traditional commercial testing tools all failed?
  4. Free software means freedom
  5. 1.4Choose a right automation framework
  6. 1.5Appium + WinAppDriver is the solution, period
  7. 1.6Synergy of web app and native app testing
  8. 1.7Desktop App Automation is harder than Web’s
  9. 1.8Challenges with Appium + WinAppDriver
  10. 1.9Next action

2First Appium Automation Script

  1. 2.1Appium’s Client-Server Architecture
  2. 2.2Set up Appium Server v1 with WinAppDriver
  3. Install and start Appium server
  4. Start a command window on Windows
  5. WinAppDriver
  6. Enable Developer mode on Windows 10
  7. 2.3Set up Appium Server v2 with WinAppDriver
  8. Install and start Appium server
  9. WinAppDriver
  10. 2.4Set up Appium Client
  11. Ruby
  12. Ruby Library for Appium v1 - appium_lib
  13. Ruby Library for Appium v2 - appium_lib
  14. 2.5First Appium Desktop App Test
  15. Open ‘Calculator’ App for Appium v1
  16. Open ‘Calculator’ App for Appium v2
  17. Drive controls on the app
  18. 2.6Control Inspector
  19. 2.7Test Tools
  20. TestWise IDE
  21. Visual Studio Code
  22. 2.8Review

3Test Syntax Framework

  1. 3.1RSpec Framework
  2. 3.2Transform automation scripts to test scripts
  3. Put it into a structure
  4. Use RSpec hooks
  5. Add Assertions
  6. Add one more test case
  7. 3.3Run RSpec tests
  8. Run RSpec test script file from the command line
  9. Run a specific test case from the command line
  10. Run RSpec tests in TestWise
  11. Run RSpec tests in Visual Studio Code
  12. 3.4Alternative test syntax frameworks

4Find App Window

  1. 4.1A closer look at the script
  2. 4.2Launch UWP App by AppId
  3. How to find a UWP’s App ID?
  4. Launch another UWP app with Appium
  5. 4.3Launch Classic App by executable
  6. 4.4Launch app with arguments
  7. 4.5Find existing App Window

5Appium Locators

  1. 5.1Tools to identify UI elements
  2. Appium Inspector
  3. WinAppDriver UI Recorder
  4. Accessibility Insights
  5. Inspect.exe
  6. Page Source
  7. 5.2Appium’s six locators
  8. Accessibility Id
  9. Name
  10. XPath
  11. Tips on simplifying XPath
  12. Class Name
  13. ID
  14. Tag Name
  15. 5.3Chain find_element to find child elements
  16. 5.4Guide on selecting locator?
  17. 5.5Advice on performance
  18. Which locator is faster?
  19. Limit the scope
  20. 5.6Find multiple elements

6Getting started

  1. 6.1An End-To-End Notepad scenario
  2. Start Notepad and type some text
  3. Find the main window
  4. Send Keys to the main window
  5. Send keys to an editor control
  6. Click a menu item
  7. Drive popup window
  8. Close the app
  9. 6.2Get Calculator App’s Information
  10. Get Window’s title
  11. Get Appium server info
  12. Get an element’s location on the page or screen
  13. Get an element’s size in pixels
  14. Get an element’s dimensions and coordinates
  15. Get an element’s attribute

7Keyboard and Mouse

  1. 7.1Keyboard
  2. Type non-visible characters
  3. Clear
  4. Type special keys
  5. Select menu item by key combinations
  6. Select menu item by keyboard shortcut
  7. 7.2Mouse
  8. Click a menu
  9. Click a button on the toolbar
  10. Double Click
  11. Context Click
  12. 7.3Advanced User Interactions
  13. Double Click
  14. Move window
  15. Context click
  16. Drag and drop
  17. Click by offset

8Assertion

  1. 8.1Assert Window title
  2. 8.2Assert Text in an Edit control
  3. 8.3Assert a control’s attributes
  4. 8.4Assert text present
  5. 8.5Assert CheckBox is checked
  6. 8.6Assert not …
  7. 8.7Assert RadioButton is checked
  8. 8.8Assert Disabled
  9. 8.9Assert ComboBox option
  10. 8.10Check equal of two elements

9Review

  1. 9.1Syntax errors
  2. How to avoid syntax errors?
  3. 9.2Set up source control
  4. Git Installation
  5. Set up Git for local working folder
  6. Set up Git for a shared folder on a network drive
  7. Frequently used Git commands after set up
  8. 9.3GUI/Object map
  9. 9.4Custom libraries
  10. 9.5Debugging
  11. 9.6What is the best learning method?

10Test Maintenance

  1. 10.1Linear test steps are hard to maintain
  2. 10.2Maintainable automated test design
  3. Intuitive to read
  4. Reusable function
  5. Page Object Model
  6. When to use Reusable Functions or Page Objects?
  7. 10.3Don’t Repeat Yourself
  8. DRY with Reusable Functions
  9. DRY with Page Objects
  10. 10.4Maintain with ease
  11. 10.5Wrap Up

11Improve Efficiency

  1. 11.1Simple project structure
  2. 11.2Test execution
  3. Run test cases in a test script file (F10)
  4. Run individual test case (Shift+F10)
  5. 11.3Quick navigation
  6. Go to Test Script File (Ctrl+T)
  7. Go to Test Case (Ctrl+Shift+T)
  8. 11.4Fast Editing with Snippets
  9. 11.5Script library
  10. 11.6Test refactoring
  11. 11.7Debug test scripts
  12. Keep the app window open
  13. Attach test execution to an existing window
  14. 11.8Wrap up

12Functional Test Refactoring

  1. 12.1Functional test refactoring
  2. Functional test refactoring goals
  3. 12.2Tool support
  4. 12.3Case study
  5. Extract Function
  6. Move to Helper
  7. Move
  8. Extract to Page Function
  9. Introduce Page Object
  10. Rename
  11. 12.4Wrap up

13Test Data

  1. 13.1Test data needs to be reusable
  2. 13.2Generate Test Data on the fly
  3. Get date dynamically
  4. Intuitive date utility by ActiveSupport
  5. Get a random boolean value
  6. Generate a number
  7. Get a random string at a fixed length
  8. Get a random string in a collection
  9. Generate random person names, emails, addresses
  10. Generate a test file at fixed sizes
  11. 13.3Retrieve data from Database
  12. 13.4Reset database

14Case Study: Test TestWise

  1. 14.1Launch App cleanly
  2. 14.2App Version
  3. 14.3Custom execution with Environment Variables
  4. 14.4Common UI elements
  5. ToolBar
  6. Checkbox
  7. Tab
  8. HyperLink
  9. Text Edit Controls
  10. Button
  11. 14.5Launch App with Argument
  12. 14.6Reusable Test Data
  13. 14.7Open a specific test file
  14. 14.8Test Automation Support in App
  15. 14.9Context Click
  16. 14.10Drag and drop
  17. 14.11Verify a file moved
  18. 14.12Wrap up

15Continuous Testing

  1. 15.1CT Overview
  2. 15.2Prerequisite
  3. Test Scripts are source controlled in Git
  4. The CT server is up running
  5. Appium set up on build machines
  6. Build Agents on build machines are up running
  7. 15.3Continuous Testing Steps
  8. Trigger a build on the server via web interface
  9. Build Agent preparation
  10. Parallel Test Execution with Build Agents
  11. 15.4Parallel Testing Lab
  12. 15.5Ongoing maintenance
  13. 15.6Test Stats or Reports

16Appium in other languages

  1. 16.1Appium with Python
  2. Install Appium Python Client
  3. First Python Appium Script
  4. First Python Appium Test
  5. 16.2Appium with C#
  6. Install Appium C# Client Library
  7. First C# Appium Script
  8. First C# Appium Test
  9. 16.3Wrap up

Resources

  1. Books
  2. Web Sites
  3. Tools

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub