ios automation: the trifecta

49
iOS Automation: The Trifecta Elizabeth Taylor Staff QA Engineer, Digimarc Corp. @blackstonefinn

Upload: blackstonefinn

Post on 10-May-2015

441 views

Category:

Technology


0 download

DESCRIPTION

I presented this at CocoaConf on 10.26.12. The Trifecta provides an easy-to-use framework for scripting your test cases and organizing your functions and test suites using XCode Instruments. http://cocoaconf.com/speaker/viewDetails/59 Questions and feedback are welcomed. @blackstonefinn

TRANSCRIPT

Page 1: iOS Automation: The Trifecta

iOS Automation:

The Trifecta Elizabeth Taylor Staff QA Engineer, Digimarc Corp. @blackstonefinn

Page 2: iOS Automation: The Trifecta

Agenda

•  Introduction •  Why automate •  What to automate •  How to automate using Xcode Instruments •  The Trifecta •  Sample Code examples •  Demo

Page 3: iOS Automation: The Trifecta
Page 4: iOS Automation: The Trifecta

Why Automate?

•  Integration testing •  Catches bugs manual testing can miss •  Exploratory Testing •  Automation <3 Stress Tests! •  Tie it to build system for check-in •  Regression testing •  Fast < 10 min per functional area •  And most of all … it’s FUN J

Page 5: iOS Automation: The Trifecta

What to automate?

•  Ask….

•  Basic App Functionality •  Boring stuff – copy & legal •  “Break it” stuff – stress tests & bugs

is it BBB?

Page 6: iOS Automation: The Trifecta

Automation Framework

•  Xcode > Developer Tool > Instruments •  Java Script API •  UI Automation Java Script Reference

Page 7: iOS Automation: The Trifecta

Script Framework - Trifecta

1. Navigate Functions

2. Validate Functions

3. Test Suite

Page 8: iOS Automation: The Trifecta

Script Framework - Trifecta

1.  Navigate functions •  Identify UI Elements •  common navigation paths •  wrap functions

2.  Validate functions •  UI element validation •  functional tests •  stress tests

3.  Test Suite •  import libraries – navigate and validate •  list validate functions

Page 9: iOS Automation: The Trifecta

Digimarc Discover UI

Page 10: iOS Automation: The Trifecta

Digimarc Discover UI

Page 11: iOS Automation: The Trifecta

Navigation Functions

Page 12: iOS Automation: The Trifecta

Navigation Functions - Purpose

•  Frequently used paths, actions •  Separate test setup v. feature test •  Contain iPhone v. iPad UI differences

Page 13: iOS Automation: The Trifecta

Creating Nav Functions

1.  ID App UI elements 2.  Write functions - code, debug, code 3.  Wrap functions

Page 14: iOS Automation: The Trifecta

Creating Nav Functions

1.  Identify UI elements

logElementTree();

Page 15: iOS Automation: The Trifecta

ID UI Elements

Page 16: iOS Automation: The Trifecta

Listen – UI Elements

Page 17: iOS Automation: The Trifecta

Navigate Function - goToTab

•  Frequently used paths, actions

Page 18: iOS Automation: The Trifecta

Navigate Function - Back

Page 19: iOS Automation: The Trifecta

ID UI Elements

Page 20: iOS Automation: The Trifecta

Help UI Elements

Page 21: iOS Automation: The Trifecta

Navigate Function – Tap Cell

•  Separate test setup v. test logic

Page 22: iOS Automation: The Trifecta

Logging

UIAlogger.logMessage(“Song Selected”);

Page 23: iOS Automation: The Trifecta

•  Contain iPhone v. iPad differences

Navigate Function – History List

Page 24: iOS Automation: The Trifecta

Wrapping Functions

1.  Readability of test script 2.  Fix or change in one place

Page 25: iOS Automation: The Trifecta

Target.delay(#)

Page 26: iOS Automation: The Trifecta

Navigate Functions ctd.

1.  Rotation 2.  Set App state at end of test

Page 27: iOS Automation: The Trifecta

Script Framework - Trifecta

ü  Navigate functions •  Identify UI Elements •  common navigation paths •  wrap functions

2.  Validate functions •  UI element validation •  functional tests •  stress tests

3.  Test Suite •  import libraries – navigate and validate •  list validate functions

Page 28: iOS Automation: The Trifecta

Validation Functions

Page 29: iOS Automation: The Trifecta

Validation Functions - Purpose

1.  Validate UI elements are correct •  Buttons, Headers •  Copy / Strings •  Images

2.  Validate functionality 3.  Stress tests

Page 30: iOS Automation: The Trifecta

Validate – UI Elements

Page 31: iOS Automation: The Trifecta

Validate - Listen UI Elements

Page 32: iOS Automation: The Trifecta

Listen UI

Page 33: iOS Automation: The Trifecta

Validate – Help UI Elements

Page 34: iOS Automation: The Trifecta

Help UI

Page 35: iOS Automation: The Trifecta

Logging

1.  Make results easy to view •  Test name w/in each function

2.  Create using Log Message 3.  Pass fail logging 4.  Screen shots 5.  Output name of test

Page 36: iOS Automation: The Trifecta

Validate – Feedback UI Elements

Page 37: iOS Automation: The Trifecta

Submit Feedback

Page 38: iOS Automation: The Trifecta

Validate – UI Elements

>

Page 39: iOS Automation: The Trifecta

Validate Functions ctd.

1.  Help – •  Submitting Feedback email

2.  History – •  Payoff rendering in-app browser •  Sharing functionality •  Deleting history list items

3.  Stress Tests

Page 40: iOS Automation: The Trifecta

Stress Test Candidates

1.  Repeated navigation across the app 2.  Drilling down into nested views 3.  Adding Rotation into the mix 4.  Exit and returning to the application 5.  Repeated item selection - history list*

Page 41: iOS Automation: The Trifecta

Script Framework - Trifecta

ü  Navigate functions •  Identify UI Elements •  common navigation paths •  wrap functions

ü  Validate functions •  UI element validation •  functional tests •  stress tests

3.  Test Suite •  import libraries – navigate and validate •  list validate functions

Page 42: iOS Automation: The Trifecta

Test Suites

Page 43: iOS Automation: The Trifecta

Test Suites

1.  Import Navigation lib 2.  Import Validation lib for area 3.  Organize by functional areas* 4.  Simple list of validation functions 5.  Logging for output readability

Page 44: iOS Automation: The Trifecta

Help - Test Suite

Page 45: iOS Automation: The Trifecta

Help Test Suite Results

Page 46: iOS Automation: The Trifecta

Script Framework - Trifecta

ü  Navigate functions •  Identify UI Elements •  common navigation paths •  wrap functions

ü  Validate functions •  UI element validation •  functional tests •  stress tests

ü  Test Suite •  import libraries – navigate and validate •  list validate functions

Page 47: iOS Automation: The Trifecta

Demo

Page 48: iOS Automation: The Trifecta

Questions & Feedback

Page 49: iOS Automation: The Trifecta

Thank you!

@blackstonefinn