SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
Android Application Testing
TANJINA ISLAM
linkedin.com/in/tanjinaislam
Agenda/Outline/Overview
 Testing Approach
 Android testing framework
 Android The Testing API
 Android testing tools
 Different automated testing frameworks
Testing Approach
 UNIT TESTING
 INTEGRATION TESTING
 MANUAL TESTING
 AUTOMATED TESTING
Unit Testing
 tests only the functionality of a certain component such as a method
(function) in a class, with all dependencies mocked up
 tests tend to be simpler and faster than integration tests
 also known as local tests
 run on a local JVM on the development machine instead of the
Android Runtime
 the execution speed of the unit test is very fast compared to tests
which require the Android system
 unit tests are executed against a modified version of the android.jar
which allows you to mocking libraries, like Mockito
Unit Testing
 Tools : JUnit
Integration Testing
 tests more than one component and how different pieces of the
system work together
 requires resources like database instances and hardware to be
allocated for them
 test many methods and may interact with dependencies like
Databases or Web Services
Unit Testing Vs. Integration Testing
 Let's, for example, assume a button in an Android activity is used to
start another activity. A unit test would determine if the corresponding
intent was issued, not if the second activity was started.
 An integration test would also check if the activity was correctly
started.
Manual Testing
 Requires Human interaction
 Tool : Human being
Automated Testing Frameworks
 Robotium
 Espresso
 uiautomator
 Robolectric
 Calabash
 Appium
 No Human Interactions
 Lots of Frameworks to automate testing
Automated Testing Frameworks
 most popular approaches used for automated Android testing:
 Google’s Android Testing Framework- This is the framework included as part of
the platform
 Robotium - Black box integration testing for Android
 Robolectric - Unit tests that run outside the emulator making the tests very fast
Android Testing Framework
 An Integral part of the development environment
 Assist on testing every aspect of application from unit testing to framework
Categories of Android Tests
 Testing for Android can be classified into:
 Local tests - tests which can run on the JVM
 Instrumented tests - tests which require the
Android system
 If possible, you should prefer to use local tests as
the test execution is much faster compared to the
time required to deploy and run the test on an
Android device
Android The Testing API
 The Android testing API is based on the JUnit API and extended with a
instrumentation framework and Android-specific testing classes.
 Junit
 Instrumentation
 TestCase Classes
 AndroidTestCase
 Component-specific test cases
 ApplicationTestCase
 InstrumentationTestCase
 Assertion classes
 Mock object classes
 Contexts for testing
Android Testing Framework
 Key Features of Testing Framework
 test suites are based on Junit
 test suites are contained in test packages similar to main application packages
 The SDK also provides
 monkeyrunner, an API for testing devices with Python programs
 UI/Application Exerciser Monkey, a command-line tool for stress-testing UIs
by sending pseudo-random events to a device
 use plain JUnit to test a class that doesn't call the Android API
 use Android's JUnit extensions to test Android components
Android Testing Tools
 Testing Support Library
 This library provides a set of APIs that helps to build and run test code for app
 The Android Testing Support Library includes the following test automation tools:
 AndroidJUnitRunner: JUnit 4-compatible test runner for Android
 Espresso: UI testing framework; suitable for functional UI testing within an app
 UI Automator: UI testing framework; suitable for cross-app functional UI testing
across system and installed apps
Android Testing Tools
 Testing Support Library
 Monkey
 is a command-line tool
 a program that runs on emulator or device
 generates pseudo-random streams of user events (such as clicks, touches, or
gestures, as well as a number of system-level events) and sends them into system
 acts as a stress test on the application, in a random yet repeatable manner
 watches the system under test
Android Testing Tools
 Testing Support Library
 monkeyrunner
 provides an API for writing programs that control an Android device or emulator
from outside of Android code
 monkeyrunner tool provides these unique features for Android testing: Multiple
device control, Functional testing, Regression testing, Extensible automation
 The monkeyrunner tool uses Jython
 Jython allows the monkeyrunner API to interact easily with the Android framework
Android Testing Tools
 Testing Support Library
 monkeyrunner
 monkeyrunner API is contained in three modules : MonkeyRunner, MonkeyDevice
and MonkeyImage
 it does not import these modules automatically
 To import a module, use the Python from statement:
from com.android.monkeyrunner import <module>
How does Android Test Framework
works
 is based on JUnit
 test tools are used to load the test
package and the application under test
 after loading package and application
test tools execute an Android-specific
test runner
 Test cases are run by a test runner class
that loads the test case class, setups,
runs, and tears down each test.
 InstrumentationTestRunner is the primary
Android test runner class.
Robotium
 is an open source library extending JUnit with plenty
of useful methods for Android UI testing
 require the application to be running on
emulator/device
 provides powerful and robust automatic black-box
test cases for Android apps (native and hybrid)
 Inherit from extension of Android class:
ActivityInstrumentationTestCase2
 Uses “Solo” class to interact with your UI
 Robotium Recorder for capturing test output and
screenshots
Robotium
 The framework handles multiple Android activities automatically.
 Minimal time needed to write solid test cases.
 Readability of test cases is greatly improved, compared to standard
instrumentation tests.
 Test cases are more robust due to the run-time binding to UI
components.
 Integrates smoothly with Maven, Gradle or Ant to run tests as part of
continuous integration.
 Relatively slow
Robotium
Espresso
 latest Android test automation framework of Google
 API is small, predictable, easy to learn and built on top of the Android instrumentation
framework
 Espresso tests can run on devices running Android 2.2 (API level 8) and higher
 we can write concise and reliable Android UI tests within a single target app
 is an instrumentation-based API and works with the AndroidJUnitRunner test runner
 Safer synchronization and thread handling
 The syntax is also a lot cleaner
 tests run optimally fast! Leave your waits, syncs, sleeps, and polls behind
 does not have support for webviews
Espresso
 Espresso is built up from 3 major components :
 ViewMatchers – allows you to locate a view in
the current view hierarchy [“find something“]
 ViewActions – allows you to interact with views
[“do something“]
 ViewAssertions – allows you to assert the state of
a view [“check something“]
 To avoid flakiness Turn off animations on testing
device
Espresso
Robotium Vs. Espresso
 The major advances in Espresso over Robotium:
1. Synchronization.
2. API.
3. Clear failure information.
Espresso Vs. Robotium
 Espresso test run is in sync with the UI
thread and does not rely on sleep/poll
mechanisms but is rather event driven
 Espresso is much faster than Robotium,
but only works on some SDK versions.
 More robust and extendable
 Tightly coupled with Android
 Example: ViewMatcher
 Custom Exception Handling
 Espresso has a small, well-defined and
predictable API, which is open to
customization
 Robotium attempts to address thread
safety with sleep/retry mechanisms, which
makes it unreliable and slower than
necessary
 Easier to use, Very stable
 prior versions of Robotium suffered from
inconsistent failure handling
 In Robotium's API, it is expected to choose
from 30+ click methods
 Robotium exposes dangerous methods like
getCurrentActivity and getView, which
allow you to operate on objects outside of
the main thread
uiautomator
 Can Test UI of native Android apps on one or more devices
 perform interactions on user apps and system apps
 is an instrumentation-based API and works with the AndroidJUnitRunner test
runner
 Requires Android 4.3 (API level 18) or higher
 is well-suited for writing black box-style automated tests
 APIs interact with visible elements on a device, regardless of which Activity is in
focus
 runs JUnit test cases with special privileges, which means test cases can span
across different processes.
 doesn’t support webview, with no way to directly access Android objects.
uiautomator
Espresso Vs. uiautomotor
 Testing UI for a Single App:
 checks that the target app returns the correct UI output in response to user
interactions in the app’s activities.
 Espresso framework is used to simulate user actions programmatically and test
complex intra-app user interactions.
 Testing UI for Multiple Apps:
 verifies the correct behavior of interactions between different user apps or
between user apps and system apps.
 UI Automator framework is used to support cross-app interactions.
Robolectric
 Robolectric is a unit test framework
 lets you run your tests inside the JVM
 Doesn’t require emulator/Device to run test
 Fastest testing suite; reduces test cycles from minutes to seconds
 No Mocking Framework is needed
 does not work for every case and only supports unit tests
 When tests fall outside its scope then we need to rely on Robotium for
complete integration testing
Robolectric
Other 3rd Party Frameworks
 Selendroid
http://selendroid.io/
 Testdroid
http://testdroid.com/
 Appium
 Calabash
References
http://developer.android.com/tools/testing/testing_android.html
https://code.google.com/p/robotium/
http://robolectric.org/
https://github.com/codepath/android_guides/wiki/Android-Unit-and-Integration-testing
http://developer.android.com/training/testing/ui-testing/espresso-testing.html
https://code.google.com/p/android-test-kit/wiki/Espresso
http://developer.android.com/tools/testing-support-library/index.html#UIAutomator
http://testdroid.com/tech/top-5-android-testing-frameworks-with-examples
https://www.youtube.com/watch?v=TGU0B4qRlHY
https://androidresearch.wordpress.com/2015/04/04/an-introduction-to-espresso/
http://www.vogella.com/tutorials/AndroidTestingEspresso/article.html
http://www.vogella.com/tutorials/AndroidTesting/article.html

Más contenido relacionado

La actualidad más candente

Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginnerAjailal Parackal
 
Mobile App Testing Strategy by RapidValue Solutions
Mobile App Testing Strategy by RapidValue SolutionsMobile App Testing Strategy by RapidValue Solutions
Mobile App Testing Strategy by RapidValue SolutionsRapidValue
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile AppsSauce Labs
 
Basic Guide to Manual Testing
Basic Guide to Manual TestingBasic Guide to Manual Testing
Basic Guide to Manual TestingHiral Gosani
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONAYESHA JAVED
 
Mobile Application Testing
Mobile Application TestingMobile Application Testing
Mobile Application TestingSWAAM Tech
 
Mobile application testing
Mobile application testingMobile application testing
Mobile application testingvodQA
 
android architecture
android architectureandroid architecture
android architectureAashita Gupta
 
What is JUnit? | Edureka
What is JUnit? | EdurekaWhat is JUnit? | Edureka
What is JUnit? | EdurekaEdureka!
 

La actualidad más candente (20)

Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Test Complete
Test CompleteTest Complete
Test Complete
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
 
Mobile App Testing Strategy by RapidValue Solutions
Mobile App Testing Strategy by RapidValue SolutionsMobile App Testing Strategy by RapidValue Solutions
Mobile App Testing Strategy by RapidValue Solutions
 
Android studio ppt
Android studio pptAndroid studio ppt
Android studio ppt
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile Apps
 
Basic Guide to Manual Testing
Basic Guide to Manual TestingBasic Guide to Manual Testing
Basic Guide to Manual Testing
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
Mobile App Testing
Mobile App TestingMobile App Testing
Mobile App Testing
 
JUnit Presentation
JUnit PresentationJUnit Presentation
JUnit Presentation
 
Mobile Application Testing
Mobile Application TestingMobile Application Testing
Mobile Application Testing
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Espresso
EspressoEspresso
Espresso
 
Mobile application testing
Mobile application testingMobile application testing
Mobile application testing
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Api testing
Api testingApi testing
Api testing
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
android architecture
android architectureandroid architecture
android architecture
 
What is JUnit? | Edureka
What is JUnit? | EdurekaWhat is JUnit? | Edureka
What is JUnit? | Edureka
 

Similar a Android testing

Testing Android Application, Droidcon Torino
Testing Android Application, Droidcon TorinoTesting Android Application, Droidcon Torino
Testing Android Application, Droidcon TorinoPietro Alberto Rossi
 
Test automationslides
Test automationslidesTest automationslides
Test automationslidesUMA MAHESWARI
 
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...Journal For Research
 
A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testingjotaemepereira
 
Automation Proposal_V1.0
Automation Proposal_V1.0Automation Proposal_V1.0
Automation Proposal_V1.0Dao Nhỏ
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfpCloudy
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation toolsSSGMCE SHEGAON
 
Android testing
Android testingAndroid testing
Android testingBitbar
 
Mobile automation testing with selenium and appium
Mobile automation testing with selenium and appiumMobile automation testing with selenium and appium
Mobile automation testing with selenium and appiumBugRaptors
 
Open Source Software Testing Tools
Open Source Software Testing ToolsOpen Source Software Testing Tools
Open Source Software Testing ToolsVaruna Harshana
 
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...Thiago Ghisi
 
Automated Testing: An Edge Over Manual Software Testing
Automated Testing: An Edge Over Manual Software TestingAutomated Testing: An Edge Over Manual Software Testing
Automated Testing: An Edge Over Manual Software Testingijtsrd
 
Lijie xia lx223809 monkeyrunner
Lijie xia lx223809 monkeyrunnerLijie xia lx223809 monkeyrunner
Lijie xia lx223809 monkeyrunnerLijie Xia
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8Mohammed Romi
 
Unit testing in android
Unit testing in androidUnit testing in android
Unit testing in androidLi-Wei Cheng
 

Similar a Android testing (20)

Testing Android Application, Droidcon Torino
Testing Android Application, Droidcon TorinoTesting Android Application, Droidcon Torino
Testing Android Application, Droidcon Torino
 
Test automationslides
Test automationslidesTest automationslides
Test automationslides
 
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
 
A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testing
 
Testing concepts
Testing conceptsTesting concepts
Testing concepts
 
Automation Proposal_V1.0
Automation Proposal_V1.0Automation Proposal_V1.0
Automation Proposal_V1.0
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
 
Android testing
Android testingAndroid testing
Android testing
 
Mobile automation testing with selenium and appium
Mobile automation testing with selenium and appiumMobile automation testing with selenium and appium
Mobile automation testing with selenium and appium
 
Open Source Software Testing Tools
Open Source Software Testing ToolsOpen Source Software Testing Tools
Open Source Software Testing Tools
 
SDET UNIT 4.pptx
SDET UNIT 4.pptxSDET UNIT 4.pptx
SDET UNIT 4.pptx
 
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...
Honeydew: a Ruby driver for UIAutomator which enables automated testing of An...
 
Robotium
RobotiumRobotium
Robotium
 
Automated Testing: An Edge Over Manual Software Testing
Automated Testing: An Edge Over Manual Software TestingAutomated Testing: An Edge Over Manual Software Testing
Automated Testing: An Edge Over Manual Software Testing
 
Lijie xia lx223809 monkeyrunner
Lijie xia lx223809 monkeyrunnerLijie xia lx223809 monkeyrunner
Lijie xia lx223809 monkeyrunner
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8
 
Automation using Appium
Automation using AppiumAutomation using Appium
Automation using Appium
 
Unit testing in android
Unit testing in androidUnit testing in android
Unit testing in android
 
Mobility testing
Mobility testingMobility testing
Mobility testing
 

Último

Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 

Último (20)

Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 

Android testing

  • 1. Android Application Testing TANJINA ISLAM linkedin.com/in/tanjinaislam
  • 2. Agenda/Outline/Overview  Testing Approach  Android testing framework  Android The Testing API  Android testing tools  Different automated testing frameworks
  • 3. Testing Approach  UNIT TESTING  INTEGRATION TESTING  MANUAL TESTING  AUTOMATED TESTING
  • 4. Unit Testing  tests only the functionality of a certain component such as a method (function) in a class, with all dependencies mocked up  tests tend to be simpler and faster than integration tests  also known as local tests  run on a local JVM on the development machine instead of the Android Runtime  the execution speed of the unit test is very fast compared to tests which require the Android system  unit tests are executed against a modified version of the android.jar which allows you to mocking libraries, like Mockito
  • 6. Integration Testing  tests more than one component and how different pieces of the system work together  requires resources like database instances and hardware to be allocated for them  test many methods and may interact with dependencies like Databases or Web Services
  • 7. Unit Testing Vs. Integration Testing  Let's, for example, assume a button in an Android activity is used to start another activity. A unit test would determine if the corresponding intent was issued, not if the second activity was started.  An integration test would also check if the activity was correctly started.
  • 8. Manual Testing  Requires Human interaction  Tool : Human being
  • 9. Automated Testing Frameworks  Robotium  Espresso  uiautomator  Robolectric  Calabash  Appium  No Human Interactions  Lots of Frameworks to automate testing
  • 10. Automated Testing Frameworks  most popular approaches used for automated Android testing:  Google’s Android Testing Framework- This is the framework included as part of the platform  Robotium - Black box integration testing for Android  Robolectric - Unit tests that run outside the emulator making the tests very fast
  • 11. Android Testing Framework  An Integral part of the development environment  Assist on testing every aspect of application from unit testing to framework
  • 12. Categories of Android Tests  Testing for Android can be classified into:  Local tests - tests which can run on the JVM  Instrumented tests - tests which require the Android system  If possible, you should prefer to use local tests as the test execution is much faster compared to the time required to deploy and run the test on an Android device
  • 13. Android The Testing API  The Android testing API is based on the JUnit API and extended with a instrumentation framework and Android-specific testing classes.  Junit  Instrumentation  TestCase Classes  AndroidTestCase  Component-specific test cases  ApplicationTestCase  InstrumentationTestCase  Assertion classes  Mock object classes  Contexts for testing
  • 14. Android Testing Framework  Key Features of Testing Framework  test suites are based on Junit  test suites are contained in test packages similar to main application packages  The SDK also provides  monkeyrunner, an API for testing devices with Python programs  UI/Application Exerciser Monkey, a command-line tool for stress-testing UIs by sending pseudo-random events to a device  use plain JUnit to test a class that doesn't call the Android API  use Android's JUnit extensions to test Android components
  • 15. Android Testing Tools  Testing Support Library  This library provides a set of APIs that helps to build and run test code for app  The Android Testing Support Library includes the following test automation tools:  AndroidJUnitRunner: JUnit 4-compatible test runner for Android  Espresso: UI testing framework; suitable for functional UI testing within an app  UI Automator: UI testing framework; suitable for cross-app functional UI testing across system and installed apps
  • 16. Android Testing Tools  Testing Support Library  Monkey  is a command-line tool  a program that runs on emulator or device  generates pseudo-random streams of user events (such as clicks, touches, or gestures, as well as a number of system-level events) and sends them into system  acts as a stress test on the application, in a random yet repeatable manner  watches the system under test
  • 17. Android Testing Tools  Testing Support Library  monkeyrunner  provides an API for writing programs that control an Android device or emulator from outside of Android code  monkeyrunner tool provides these unique features for Android testing: Multiple device control, Functional testing, Regression testing, Extensible automation  The monkeyrunner tool uses Jython  Jython allows the monkeyrunner API to interact easily with the Android framework
  • 18. Android Testing Tools  Testing Support Library  monkeyrunner  monkeyrunner API is contained in three modules : MonkeyRunner, MonkeyDevice and MonkeyImage  it does not import these modules automatically  To import a module, use the Python from statement: from com.android.monkeyrunner import <module>
  • 19. How does Android Test Framework works  is based on JUnit  test tools are used to load the test package and the application under test  after loading package and application test tools execute an Android-specific test runner  Test cases are run by a test runner class that loads the test case class, setups, runs, and tears down each test.  InstrumentationTestRunner is the primary Android test runner class.
  • 20. Robotium  is an open source library extending JUnit with plenty of useful methods for Android UI testing  require the application to be running on emulator/device  provides powerful and robust automatic black-box test cases for Android apps (native and hybrid)  Inherit from extension of Android class: ActivityInstrumentationTestCase2  Uses “Solo” class to interact with your UI  Robotium Recorder for capturing test output and screenshots
  • 21. Robotium  The framework handles multiple Android activities automatically.  Minimal time needed to write solid test cases.  Readability of test cases is greatly improved, compared to standard instrumentation tests.  Test cases are more robust due to the run-time binding to UI components.  Integrates smoothly with Maven, Gradle or Ant to run tests as part of continuous integration.  Relatively slow
  • 23. Espresso  latest Android test automation framework of Google  API is small, predictable, easy to learn and built on top of the Android instrumentation framework  Espresso tests can run on devices running Android 2.2 (API level 8) and higher  we can write concise and reliable Android UI tests within a single target app  is an instrumentation-based API and works with the AndroidJUnitRunner test runner  Safer synchronization and thread handling  The syntax is also a lot cleaner  tests run optimally fast! Leave your waits, syncs, sleeps, and polls behind  does not have support for webviews
  • 24. Espresso  Espresso is built up from 3 major components :  ViewMatchers – allows you to locate a view in the current view hierarchy [“find something“]  ViewActions – allows you to interact with views [“do something“]  ViewAssertions – allows you to assert the state of a view [“check something“]  To avoid flakiness Turn off animations on testing device
  • 26. Robotium Vs. Espresso  The major advances in Espresso over Robotium: 1. Synchronization. 2. API. 3. Clear failure information.
  • 27. Espresso Vs. Robotium  Espresso test run is in sync with the UI thread and does not rely on sleep/poll mechanisms but is rather event driven  Espresso is much faster than Robotium, but only works on some SDK versions.  More robust and extendable  Tightly coupled with Android  Example: ViewMatcher  Custom Exception Handling  Espresso has a small, well-defined and predictable API, which is open to customization  Robotium attempts to address thread safety with sleep/retry mechanisms, which makes it unreliable and slower than necessary  Easier to use, Very stable  prior versions of Robotium suffered from inconsistent failure handling  In Robotium's API, it is expected to choose from 30+ click methods  Robotium exposes dangerous methods like getCurrentActivity and getView, which allow you to operate on objects outside of the main thread
  • 28. uiautomator  Can Test UI of native Android apps on one or more devices  perform interactions on user apps and system apps  is an instrumentation-based API and works with the AndroidJUnitRunner test runner  Requires Android 4.3 (API level 18) or higher  is well-suited for writing black box-style automated tests  APIs interact with visible elements on a device, regardless of which Activity is in focus  runs JUnit test cases with special privileges, which means test cases can span across different processes.  doesn’t support webview, with no way to directly access Android objects.
  • 30. Espresso Vs. uiautomotor  Testing UI for a Single App:  checks that the target app returns the correct UI output in response to user interactions in the app’s activities.  Espresso framework is used to simulate user actions programmatically and test complex intra-app user interactions.  Testing UI for Multiple Apps:  verifies the correct behavior of interactions between different user apps or between user apps and system apps.  UI Automator framework is used to support cross-app interactions.
  • 31. Robolectric  Robolectric is a unit test framework  lets you run your tests inside the JVM  Doesn’t require emulator/Device to run test  Fastest testing suite; reduces test cycles from minutes to seconds  No Mocking Framework is needed  does not work for every case and only supports unit tests  When tests fall outside its scope then we need to rely on Robotium for complete integration testing
  • 33. Other 3rd Party Frameworks  Selendroid http://selendroid.io/  Testdroid http://testdroid.com/  Appium  Calabash