testing android applications with maveryx

48
© 2014 Maveryx srl. All rights reserved. Testing Android Applications with Maveryx

Upload: maveryx

Post on 25-Jul-2015

434 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Testing Android applications with Maveryx

© 2014 Maveryx srl.

All rights reserved.

Testing Android Applications with Maveryx

Page 2: Testing Android applications with Maveryx

� What is Maveryx

� Why Maveryx

� Step-by-Step guide to test an Android

app using Maveryx

Overview

Page 3: Testing Android applications with Maveryx

© 2014 Maveryx srl.

All rights reserved.

What is Maveryx

Page 4: Testing Android applications with Maveryx

Maveryx is a professional, award-winning test automation tool for

functional and regression testing of Java™ & Android™ applications.

Maveryx provides testers with automated testing capabilities for

functional, regression, GUI, data-driven and keyword-driven testing.

Maveryx

Page 5: Testing Android applications with Maveryx

� No GUI Maps ⇒ Runtime GUI

Inspection tool

� Intelligent UI Objects Recognition

� Code-free Keyword-driven Testing

� Data-driven testing

� Assertion-based Verification

Points

� Extension plugin mechanism

� Suitable for Java™ and Android™

� Standard Test Logging

� Built on Java™ and JUnit (the

Android Test Framework)

� Test Data Generation Tool

� Advanced Test API

� Available as Android ADT plugin

� …

Features

© 2014 Maveryx srl.

All rights reserved.

Page 6: Testing Android applications with Maveryx

� Tests can be executed on Android Virtual Devices (AVDs) or Real Devices

⇒ No Rooting!

� devices connected to the local PC [via USB cable or Wi-Fi]

� devices connected remotely to a mobile device lab

� Support for all versions of Android

� Support for almost all UI Elements

� Full & complete integration into

Android ADT

� …

© 2014 Maveryx srl.

All rights reserved.

NO ROOTING!

On Emulators and Real Devices

Page 7: Testing Android applications with Maveryx

© 2014 Maveryx srl.

All rights reserved.

Why Maveryx?

Page 8: Testing Android applications with Maveryx

No UI Maps. No Recording.

No recording. No capture. No UI Maps.

o NO UI MAPS or Object Repositories to ‘learn’ & maintain

o No pre-recording or UI capture

o Test scripts immediately executable!

o Automatic UI inspection directly at runtime

Page 9: Testing Android applications with Maveryx

o “Classical” to Fuzzy matching algorithms to unambiguously recognize and locate UI objects directly at runtime during test execution

o Automatically accommodate UI changes without modifying the tests

o “Geolocation” of objects in the User Interface (TOP, BOTTOM, LEFT, RIGHT …)

Unique object identification

© 2014 Maveryx srl.

All rights reserved.

TOP

BOTTOM

L

E

F

T

R

I

G

H

T

CENTER

Page 10: Testing Android applications with Maveryx

o Code-free Keyword-driven Testing

o Keyword testing driven from Excel™ sheets and XML files

o No coding required ⇒ short time to implement

o Data-driven testing

o Dedicated scripting API for data-driven testing

o Varying set of data sources : Excel™ sheets , CSV & XML files

Testing Methodology

© 2014 Maveryx srl.

All rights reserved.

Page 11: Testing Android applications with Maveryx

o Standard Test Logging and Reporting

o XML ⇒ HTML test reports

o ASCII test logs

o Automated capturing of screenshots on test failures

o Test Execution Metrics

Test Logging

© 2014 Maveryx srl.

All rights reserved.

Page 12: Testing Android applications with Maveryx

© 2014 Maveryx srl.

All rights reserved.

One script for all applications

Maveryx allows to create automated tests

that can be run without modification against

any Android apps, as well as Java desktop

applications on all platforms.

Page 13: Testing Android applications with Maveryx

© 2014 Maveryx srl.

All rights reserved.

Testing an Android ApplicationStep-by-Step

Page 14: Testing Android applications with Maveryx

The ADT PluginMaveryx

Perspective JUnit integration Action buttons Report / Metrics View

Page 15: Testing Android applications with Maveryx

The Application-under-test

You can download the ApiDemos project package at:

https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/

Page 16: Testing Android applications with Maveryx

Import the Application-Under-Test

1. In Eclipse ADT, chose File→ Import… to import

the Existing Android Code Into Workspace and

select the root folder of the unpacked project

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

The ADT may throws the error “Unable to resolve target ‘android-XX'”.

Open project.properties file present under the project folder and update the

target version.

Page 17: Testing Android applications with Maveryx

Create the Runner Project (1)

1. In Eclipse, select File→ New→ Other…

2. In the Select a Wizard dialog, expand Android

and select Android Test Project.

3. Click Next.

4. In the New Android Test Project wizard, enter a

Name for the test project and click Next

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 18: Testing Android applications with Maveryx

Create the Runner Project (2)

1. In the Select Test Target panel, set An

Existing Android Project.

2. Select the Android application under test.

3. In the Build Target panel, select the Android

SDK platform.

4. Click Next and then Finish.

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 19: Testing Android applications with Maveryx

Configure the Runner Project (1)

1. In the Package Explorer, right click on the

project and select Build Path→ Configure

Build Path...

2. In the Libraries tab, in the Properties panel,

click on Add External JARs... and add the

following jars :

a. bootstrapForAndroid.jar

b. factory.jar

c. jdom.jar

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 20: Testing Android applications with Maveryx

Configure the Runner Project (2)

1. In the Order and Export tab select the

following jars:

a. bootstrapForAndroid.jar

b. factory.jar

c. jdom.jar

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 21: Testing Android applications with Maveryx

Create the Runner Class (1)

1. In Eclipse, select File→ New→ Class

2. In the New Java Class dialog, enter a name

for this class: “Runner”.

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 22: Testing Android applications with Maveryx

Create the Runner Class (2)

Import the package containing the main

activity of the application-under-test.

The main activity (class) of the application-

under-test.

Page 23: Testing Android applications with Maveryx

Create a New Test Project

1. Select File→ New→Maveryx Test Project

In the Maveryx Test Project window

1. enter the Project name

2. in the JRE section make sure that Java/JRE

6 or higher is selected

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 24: Testing Android applications with Maveryx

Create a New Test Script

1. Select File→ New→Maveryx Test Class

In the Maveryx Test Class window

1. enter a name for the Package

2. enter a Name for the test class / script

To test an Android application using Maveryx :1. Import the Application Under Test2. Create the Runner Project3. Create a Maveryx Test Project

Page 25: Testing Android applications with Maveryx

Create the Launch file

To execute the application-under-test it

is necessary to create the related

launch file (⇒ XML file).

Create a launch file as the one in figure

by changing:

1. the Android ADB path

2. the Working Directory

3. the JRE path

Page 26: Testing Android applications with Maveryx

The Test Case

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10.Check that the "Radiobutton 1" is selected

11.Return to the "Controls" items

12.Close the application-under-test

Page 27: Testing Android applications with Maveryx

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Connect to the application

Page 28: Testing Android applications with Maveryx

Connect to the application

The static method connect(ApplicationPathName,

ConfigFilePath) in class Bootstrap allows to connect

to the application-under-test

Page 29: Testing Android applications with Maveryx

Working with lists

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 30: Testing Android applications with Maveryx

Working with lists

1. Create a new GuiList object

2. Scroll down the list

3. Create a new GuiLabel object specifying

the text

4. Click the label

Page 31: Testing Android applications with Maveryx

Working with text fields

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 32: Testing Android applications with Maveryx

Working with text fields

1. Create a new GuiText object

2. Type the text

3. Verification Point : check that the text is

set correctly

Page 33: Testing Android applications with Maveryx

Working with check boxes

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 34: Testing Android applications with Maveryx

Working with check boxes

1. Create a new GuiCheckBox object

specifying the caption

2. Click the check box

3. Verification Point : check that the check

box is selected

Page 35: Testing Android applications with Maveryx

Working with radio buttons

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 36: Testing Android applications with Maveryx

Working with radio buttons

1. Create a new GuiRadioButton object

specifying the caption

2. Click the radio button

3. Verification Point : check that the radio

button is selected

Page 37: Testing Android applications with Maveryx

Working with device buttons

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text is set

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 38: Testing Android applications with Maveryx

Working with device buttons

1. Click the Back button

2. Click the Home button

Page 39: Testing Android applications with Maveryx

Close the application

Test Case #001

1. Connect to the application-under-test

2. Select the item "Views"

3. Select the item "Controls"

4. Select the item "1. Light Theme"

5. Insert a text into the text field

6. Check that the text has entered

7. Click the "Checkbox 1"

8. Check that the "Checkbox 1" is selected

9. Click the "Radiobutton 1"

10. Check that the "Radiobutton 1" is selected

11. Return to the items in "Controls"

12. Close the application-under-test

Page 40: Testing Android applications with Maveryx

Test Case #001

Page 41: Testing Android applications with Maveryx

Launch the application (1)

1. Select the Runner class

2. Select Run As→ Android JUnit Test

Page 42: Testing Android applications with Maveryx

Launch the application (2)

Page 43: Testing Android applications with Maveryx

Run the Test Script

1. Select Run As...→ JUnit Test

2. Select the Eclipse JUnit Launcher

Page 44: Testing Android applications with Maveryx

View the Test Results

1. Test Results

2. Test Metrics

3. Test Console

Log

Page 45: Testing Android applications with Maveryx

The Test Report

Page 46: Testing Android applications with Maveryx

Lesson Learned

o NO UI MAPS needed to create and run the tests

o No pre-recording or UI capture required

o Test scripts can be created in parallel with software development

o Test scripts immediately executable (as soon as application is available)

o No Rooting required

o Integrated into the Android ADT

Page 47: Testing Android applications with Maveryx

Useful Links

o Maveryx – http://www.maveryx.com

o User guide – http://www.maveryx.com/en/support/learn-

more/user-documentation.html

o Forum – http://www.maveryx.com/en/forum/index.html

o Training – http://www.maveryx.com/en/services/training.html

Page 48: Testing Android applications with Maveryx

Thank You!

• www.maveryx.com

[email protected]

[email protected]