Upload
maveryx
View
437
Download
0
Embed Size (px)
Citation preview
© 2014 Maveryx srl.
All rights reserved.
Testing Android Applications with Maveryx
� What is Maveryx
� Why Maveryx
� Step-by-Step guide to test an Android
app using Maveryx
Overview
© 2014 Maveryx srl.
All rights reserved.
What is 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
� 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.
� 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
© 2014 Maveryx srl.
All rights reserved.
Why 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
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
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.
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.
© 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.
© 2014 Maveryx srl.
All rights reserved.
Testing an Android ApplicationStep-by-Step
The ADT PluginMaveryx
Perspective JUnit integration Action buttons Report / Metrics View
The Application-under-test
You can download the ApiDemos project package at:
https://android.googlesource.com/platform/development/+/master/samples/ApiDemos/
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.
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
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
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
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
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
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.
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
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
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
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
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
Connect to the application
The static method connect(ApplicationPathName,
ConfigFilePath) in class Bootstrap allows to connect
to the application-under-test
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
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
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
Working with text fields
1. Create a new GuiText object
2. Type the text
3. Verification Point : check that the text is
set correctly
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
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
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
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
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
Working with device buttons
1. Click the Back button
2. Click the Home button
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
Test Case #001
Launch the application (1)
1. Select the Runner class
2. Select Run As→ Android JUnit Test
Launch the application (2)
Run the Test Script
1. Select Run As...→ JUnit Test
2. Select the Eclipse JUnit Launcher
View the Test Results
1. Test Results
2. Test Metrics
3. Test Console
Log
The Test Report
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
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