mobile test automation

43
Mobile Test Automation Andreas Jakl @ andijakl [email protected] Mobile Developer After-Work #7 – Xamarin: April 9 th , 2015

Upload: andreas-jakl

Post on 17-Jul-2015

265 views

Category:

Mobile


3 download

TRANSCRIPT

Page 1: Mobile Test Automation

Mobile Test Automation

Andreas Jakl

@andijakl

[email protected]

Mobile Developer After-Work #7 – Xamarin: April 9th, 2015

Page 2: Mobile Test Automation

Andreas Jakl

Mobility Evangelist, Tieto

– @andijakl

[email protected]

History

– Mopius: Startup-Founder (NFC & Mobile Apps)

– Nokia, Finland: Technology Wizard

– FH Hagenberg: Assistant Professor Mobile Computing

– Siemens / BenQ Mobile, Germany: Augmented Reality-Apps

Mobile Test Automation - Andreas Jakl2

Page 3: Mobile Test Automation

TESTING – WHY?

Versions & More

Mobile Test Automation - Andreas Jakl3

Page 4: Mobile Test Automation

Slow uptake of new

versions

Manufacturer-

modified UIs

Countless screen

sizes & densities

Mobile Test Automation - Andreas Jakl4

https://developer.android.com/about/dashboards/index.html

http://stats.unity3d.com/mobile/os-android.html

Page 5: Mobile Test Automation

Fast adoption of new OS

– Design updates

– API & architecture changes

(e.g., 64 bit enforcement)

Quick update of apps required

Same OS version, but many iOS

devices in use

Mobile Test Automation - Andreas Jakl5

https://developer.apple.com/support/appstore/

http://stats.unity3d.com/mobile/device-ios.html

Page 6: Mobile Test Automation

Similar hardware & software base

– 512 MB vs 1+ GB memory

– Processor speed

– 4 supported screen resolutions

Relevant: v8(.1) > 90%

– But: Windows 10 upcoming

• More resolutions, etc.

Mobile Test Automation - Andreas Jakl6

http://blogs.windows.com/buildingapps/2014/12/22/windows-and-windows-phone-store-trends-december-2014-update/

http://blog.adduplex.com/2015/03/adduplex-windows-phone-statistics.html

Page 7: Mobile Test Automation

IMPACT OF TESTING

Successful?

Mobile Test Automation - Andreas Jakl7

Page 8: Mobile Test Automation

Reviews vs Downloads

Review count & rating correlate to downloads

Mobile Test Automation - Andreas Jakl8

Bin Lu, et al.: Why People Hate Your App – Making Sense of User Feedback in a Mobile App Store.

Carnegie Mellon University, 2013

Data from 13 million user reviews, 171,439 apps

Average rating: 3.9

(standard deviation: 1.48)

0

2 000 000

4 000 000

6 000 000

8 000 000

Page 9: Mobile Test Automation

Review Analysis

Analysis

– Most frequent complaints

• Functional errors

• Feature requests

• App crashes

Mobile Test Automation - Andreas Jakl9

Claudia Iacob, Rachel Harrison: “Retrieving and Analysing Mobile Apps Feature Requests from Online Reviews”, Oxford Brookes University, 2013

Kahlid. H, et al.: “What Do Mobile App Users Complain About? A Study on Free iOS Apps”, Queen’s University, Kingston, 2014

Gunwoong Leea, T. S. Raghua: “Determinants of Mobile Apps' Success: Evidence from the App Store Market”, 2014

Page 10: Mobile Test Automation

Review Analysis

Analysis

– Most negative impact

• Privacy and ethical issues

• Hidden app costs

Mobile Test Automation - Andreas Jakl10

Claudia Iacob, Rachel Harrison: “Retrieving and Analysing Mobile Apps Feature Requests from Online Reviews”, Oxford Brookes University, 2013

Kahlid. H, et al.: “What Do Mobile App Users Complain About? A Study on Free iOS Apps”, Queen’s University, Kingston, 2014

Gunwoong Leea, T. S. Raghua: “Determinants of Mobile Apps' Success: Evidence from the App Store Market”, 2014

Page 11: Mobile Test Automation

Customer Retention

Quality (feature)

upgrades

– Up to 3x

improvement in

survival rates

Mobile Test Automation - Andreas Jakl11

0%

5%

10%

15%

20%

25%

30%

35%

40%

45%

1 Month after Download 6 Months after Download 1 Year after Download

Customer Retention in Mobile Apps

Page 12: Mobile Test Automation

TESTING STRATEGIES

Manual

Mobile Test Automation - Andreas Jakl12

Page 13: Mobile Test Automation

Capturing Crash Data

Mobile Test Automation - Andreas Jakl13

Page 14: Mobile Test Automation

Monitoring User Reviews

Mobile Test Automation - Andreas Jakl14

Bin Lu, et al.: Why People Hate Your App – Making Sense of User Feedback in a Mobile App Store.

Carnegie Mellon University, 2013

Page 15: Mobile Test Automation

Static Code Analysis

Mobile Test Automation - Andreas Jakl15

Page 16: Mobile Test Automation

Emulator / Simulator

Mobile Test Automation - Andreas Jakl16

Emulator

Emulates real

hardware

+ more accurate

– slow

Android

Simulator

Simulates device

behavior

+ faster

– less accurate

iOS / Windows

Page 17: Mobile Test Automation

Reliable?

Mobile Test Automation - Andreas Jakl17

0%of your users will run your app on an emulator

Page 18: Mobile Test Automation

Own Devices

Mobile Test Automation - Andreas Jakl18

How many test devices do you have?

Page 19: Mobile Test Automation

Open Device Lab Vienna

Mobile Test Automation - Andreas Jakl19

Free testing on real devices

http://www.open-device-lab-vienna.at/

Page 20: Mobile Test Automation

Automated UI Tests

Mobile Test Automation - Andreas Jakl20

How many tests can you run per hour / build / release?

Number of builds

Cost

Automated tests

Manual tests

Page 21: Mobile Test Automation

TEST CLOUD

Automated Testing on 1000s of Devices

Mobile Test Automation - Andreas Jakl21

Page 22: Mobile Test Automation

Xamarin Test Cloud

Automated tests

– UI interaction

– Device features (GPS, etc)

– Performance

1,300+ devices

– Android & iOS

– testcloud.xamarin.com/devices

Mobile Test Automation - Andreas Jakl22

Page 23: Mobile Test Automation

Workflow

Mobile Test Automation - Andreas Jakl23

Page 24: Mobile Test Automation

+ Continuous Integration

Mobile Test Automation - Andreas Jakl24

Page 25: Mobile Test Automation

Calabash Xamarin.UiTest

Test Frameworks

Mobile Test Automation - Andreas Jakl25

Write tests in Ruby C#

Run with Gherkin NUnit

Page 26: Mobile Test Automation

Executing Tests

Mobile Test Automation - Andreas Jakl26

Page 27: Mobile Test Automation

Process

1. Write Tests

2. Setup Project for Testing

3. Test Locally

4. Create app on Xamarin Test Cloud

5. Upload & Run on Cloud via Command Line

Mobile Test Automation - Andreas Jakl27

Page 28: Mobile Test Automation

Writing Tests: NUnit

Mobile Test Automation - Andreas Jakl28

Generic tests possible

with Xamarin.Forms

Page 29: Mobile Test Automation

Test Setup

Mobile Test Automation - Andreas Jakl29

Platform-specific

initialization & test

differences

Page 30: Mobile Test Automation

Setup Project

Mobile Test Automation - Andreas Jakl30

Disable shared

Mono runtime

Page 31: Mobile Test Automation

API Key

Mobile Test Automation - Andreas Jakl31

Create team & app to

get unique API key

Page 32: Mobile Test Automation

Run Tests

Locally

Mobile Test Automation - Andreas Jakl32

Test on your

devices first

Page 33: Mobile Test Automation

Mobile Test Automation - Andreas Jakl33

Cloud Setup

Choose devices

Page 34: Mobile Test Automation

Mobile Test Automation - Andreas Jakl34

Cloud Setup

System settings

Page 35: Mobile Test Automation

Mobile Test Automation - Andreas Jakl35

Running Tests

in the cloud

Command line

only

Page 36: Mobile Test Automation

Mobile Test Automation - Andreas Jakl36

Test results

Dashboard

Page 37: Mobile Test Automation

Mobile Test Automation - Andreas Jakl37

Test results

Screenshots

Page 38: Mobile Test Automation

Custom Screenshots

Take & describe screenshots

Enable local screenshots

Mobile Test Automation - Andreas Jakl38

[TestCase (TestName = "Click button and show success message")]public void TestCaseSuccess (){

AppResult[] result = _app.Query(InitialMessage);Assert.IsTrue(result.Any(), "The initial message string isn't correct");_app.Screenshot ("Initial screen");

_app = ConfigureApp.Android.ApkFile(PathToAPK).ApiKey("YOUR_API_KEY").EnableLocalScreenshots().StartApp();

Page 39: Mobile Test Automation

Custom Screenshots

Take & describe screenshots

Enable local screenshots

Mobile Test Automation - Andreas Jakl39

[TestCase (TestName = "Click button and show success message")]public void TestCaseSuccess (){

AppResult[] result = _app.Query(InitialMessage);Assert.IsTrue(result.Any(), "The initial message string isn't correct");_app.Screenshot ("Initial screen");

_app = ConfigureApp.Android.ApkFile(PathToAPK).ApiKey("YOUR_API_KEY").EnableLocalScreenshots().StartApp();

Page 40: Mobile Test Automation

Testing Finished App Packages

Find IDs of UI elements

Mobile Test Automation - Andreas Jakl40

if (TestEnvironment.Platform.Equals(TestPlatform.Local)){

_app = ConfigureApp.Android.ApkFile(PathToAPK).ApiKey("YOUR_API_KEY").EnableLocalScreenshots().StartApp();

_app.Repl ();// In Bash, enter app.Query(c=>c.Button()) or c.All()

}

Page 41: Mobile Test Automation

Testing Finished App Packages

Find IDs of UI elements

Mobile Test Automation - Andreas Jakl41

if (TestEnvironment.Platform.Equals(TestPlatform.Local)){

_app = ConfigureApp.Android.ApkFile(PathToAPK).ApiKey("YOUR_API_KEY").EnableLocalScreenshots().StartApp();

_app.Repl ();// In Bash, enter app.Query(c=>c.All())

}

Page 42: Mobile Test Automation

Alternatives

Testdroid

– testdroid.com/

Perfecto Mobile

– perfectomobile.com/solution/test-automation

Mobile Test Automation - Andreas Jakl42

Page 43: Mobile Test Automation

Thank You!

Andreas Jakl

@andijakl

[email protected]

Mobile Test Automation - Andreas Jakl43