SlideShare a Scribd company logo
Robotium
Test FrameWork
-Sampath Muddineni
Session Agenda
• Robotium… What is it?
• Where to get it and how to set it up
• “Normal” Android unit testing background
• Why Robotium is needed
• Using Robotium
• Robotium Tips/Tricks/Issues
• Complimentary tools
• Further Resources
• Q&A
Robotium – what is it?
• An open source test framework
• Used to write black or white box tests (emphasis is on black box)
• White box testing – testing software that knows and tests the internal
structures or workings of an application
• Black box testing – testing software functionality without knowledge of an
application (perhaps where the source code is not even available)
• Tests can be executed on an Android Virtual Device (AVD) or real device
• Built on Java (and Android) and JUnit (the Android Test Framework)
• In fact, it may be more appropriate to call Robotium an extension to the
Android test framework
Robotium Project Setup
• Install and setup JDK
• Install and setup Eclipse (optional)
• Install and setup Android Standard Development Kit (SDK)
• Supports Android 1.6 (API level 4) and above
• Install and setup Android Development Tools (ADT) for Eclipse (optional)
• Create Android AVD or attach device by USB
• Create an Android Test Project
• Download Robotium JAR and add to project classpath
• robotium-solo-X.X.jar (version 3.6 the latest as of this writing)
• From code.google.com/p/robotium/downloads/list
Background-Android JUnit Testing
• Android testing is based on JUnit
• You create test suites, classes (test cases), methods
• Organize tests into a Android Test project
• No annotations
• Test case classes can extend good-old-fashion JUnit3 TestCase
• To call Android APIs, base class must extend AndroidTestCase
• Use JUnit Assert class to check/display test results
• Execute tests using an SDK provided InstrumentationTestRunner
• android.test.InstrumentationTestRunner
• Usually handled automatically via IDE
Android Test Architecture
Robotium Project Setup
The “App” Used to Demo Today
Name should be in format : Last name,First name
Email Should end with “.com”
Should choose atleast one radio button
Should contain only numbers
Should choose atleast one checkbox
Robotium Project Setup
• Prerequisites
• Install and setup JDK
• Install and setup Eclipse (optional)
• Install and setup Android Standard Development Kit (SDK)
• Supports Android 1.6 (API level 4) and above
• Install and setup Android Development Tools (ADT) for Eclipse (optional)
• Create Android AVD or attach device by USB
• Create an Android Test Project
• Download Robotium JAR and add to project classpath
• robotium-solo-X.X.jar (version 3.6 the latest as of this writing)
Example Junit Test
Example Junit Test (Continued)
Robotium Solo API
• Robotium is all baked into one class - Solo – with many methods:
• clickX methods: clickOnButton, clickOnImage, clickOnText,…
• clickLongX methods: clickLongInList, clickLongOnScreen, clickLongOnText,…
• enterText
• drag
• getX methods: getButton, getCurrentActivity, getImage, getEditText, …
• goBack
• isX methods: isCheckBoxChecked, isRadioButtonChecked,isSpinnerTextSelected,
isTextChecked,…
• pressX methods: pressMenuItem, pressMenuItem, pressSpinnerItem, …
• scrollX methods: scrollToTop, scrollToBottom, …
• searchX methods: searchButton, searchEditText, searchText, …
• waitForX methods: waitForActivity, waitForText, …
Some Robotium commands
• clickOnButton(String regex)
• clickInList(int line)
• enterText(int index, String text)
• searchText(String regex)
• clickOnMenuItem(String regex)
• getCurrentActivity()
• goBack(), goBackToActivity(String name)
Example Robotium commands
public void testAdd() {
solo.enterText(0, "5");
solo.enterText(1,"3");
solo.clickOnButton("Add");
assertTrue(solo.searchEditText("8.0"));
}
Tips / Tricks / Issues
Robotium (and all JUnit tests) operate in the
same process (DVM) as the original app
• Robotium only works with the activities and views within the defined app
• For example: Can’t use intent to launch another app and test activity work
from that app
The popup keyboard is accomplished with a
bitmap in Android
• Robotium (or any unit test software) doesn’t see the “keys” as buttons or
anything.
Tips / Tricks / Issues
Use waitFor methods liberally.
• Especially if new screen opens or changes to what is displayed are
occurring.
• The waitFor methods tell Robotium to wait for a condition to happen
before the execution continues.
public void testGoodLogin() {
solo.enterText(0, “username");
solo.enterText(1, “password");
String label = res.getString(R.string.login_button_label); solo.clickOnButton(label);
String title = res.getString(R.string.title_activity_systemv); solo.waitForText(title);
solo.assertCurrentActivity("systemv", SystemVActivity.class); solo.getCurrentActivity().finish();
}
Tips / Tricks / Issues
RadioButtons are Buttons, EditText are Text,
etc…
• Getting the proper widget by index can be more
difficult
• Use of index also makes the test case more brittle
due to potential layout changes
• Consider clickOnButton(“Clear”) vs.
clickOnButton(6)
Tips / Tricks / Issues
Resources in Android are at a premium
(especially when test cases and App code are
running in same DVM).
• Use solo.finishOpenedActivities() in your tearDown method.
• It closes all the opened activities.
• Frees resources for the next tests
• Robotium has some difficulty with animations
• Robotium doesn’t work with status bar notifications
Tips / Tricks / Issues
Black Box Testing (when all you have is the
APK file) is a little more tricky.
• Recall in the demo, the test application wants the main activity name?
public TestDataCollectionActivity() {
super(DataCollectionActivity.class);
}
• You may not know this for a 3rd party/black box app.
• You can get the activity name by loading the APK to an AVD or device, running it, and watching the
logcat.
• The APK file has to have the same certificate signature as the test project.
• Probably have to delete the signature and then resign the APK with the Android debug key
signature.
•It’s easier than it sounds.
Tips / Tricks / Issues
• Robotium can automatically take screenshots
• solo.takeScreenshot( )
• Robotium can be run from the command line (using adb shell)
• adb shell am instrument -w com.android.foo/android.test.InstrumentationTestRunner
• Robotium can test with localized strings
• solo.getString(localized_resource_string_id)
• Code coverage is a bit lackluster at this time
• Can be done with special ant task and command line tools
• Robotium does not work on Flash or Web apps.
Tips / Tricks / Issues
Benefits
● Easy to write, shorter code
● Automatic timing and delays
● Automatically follows current Activity
● Automatically finds Views
● Automatically makes own decisions
● when to scroll etc.
● No modification to Android platform
● Test execution is fast
Tips / Tricks / Issues
Required to know implementation details
● You often have to manually add Thread.sleep(500) to make tests work
● Large apps can be very complex to test
● Tests run slowly like if it would be done manually
Queriers??????????
Thank You

More Related Content

What's hot

Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
Rody Middelkoop
 
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Svetlin Nakov
 
Testing for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test AutomationTesting for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test Automation
Trent Peterson
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and Android
Tomáš Kypta
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012
Daniel Knott
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
Kan-Han (John) Lu
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
Eduardo Carrara de Araujo
 
A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testing
jotaemepereira
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
Marakana Inc.
 
Android unittesting
Android unittestingAndroid unittesting
Android unittesting
QA Club Kiev
 
Utilizando Espresso e UIAutomator no Teste de Apps Android
Utilizando Espresso e UIAutomator no Teste de Apps AndroidUtilizando Espresso e UIAutomator no Teste de Apps Android
Utilizando Espresso e UIAutomator no Teste de Apps Android
Eduardo Carrara de Araujo
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
Hazem Saleh
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
SSGMCE SHEGAON
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
Kuldeep Pawar
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
Parinita03
 
Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studio
Farabi Technology Middle East
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
IlPeach
 
Dagger for android
Dagger for androidDagger for android
Dagger for android
Kan-Han (John) Lu
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
Engineor
 

What's hot (20)

Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
 
Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021
 
Testing for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test AutomationTesting for Android: When, Where, and How to Successfully Use Test Automation
Testing for Android: When, Where, and How to Successfully Use Test Automation
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and Android
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
 
A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testing
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
 
Android unittesting
Android unittestingAndroid unittesting
Android unittesting
 
Utilizando Espresso e UIAutomator no Teste de Apps Android
Utilizando Espresso e UIAutomator no Teste de Apps AndroidUtilizando Espresso e UIAutomator no Teste de Apps Android
Utilizando Espresso e UIAutomator no Teste de Apps Android
 
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studio
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Dagger for android
Dagger for androidDagger for android
Dagger for android
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
 

Similar to Robotium - sampath

Introduction to Robotium
Introduction to RobotiumIntroduction to Robotium
Introduction to Robotium
alii abbb
 
A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"
DataArt
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
Ari Lacenski
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
Enrique López Mañas
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
ICS
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
Phat VU
 
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
Bitbar
 
Testing in Android: automatici, di integrazione, TDD e scenari avanzati
Testing in Android: automatici, di integrazione, TDD e scenari avanzatiTesting in Android: automatici, di integrazione, TDD e scenari avanzati
Testing in Android: automatici, di integrazione, TDD e scenari avanzati
Alfredo Morresi
 
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
DevDay.org
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
Shai Raiten
 
codeduiws-130507074566782958-phpapp02.pdf
codeduiws-130507074566782958-phpapp02.pdfcodeduiws-130507074566782958-phpapp02.pdf
codeduiws-130507074566782958-phpapp02.pdf
Patiento Del Mar
 
Testing - How Vital and How Easy to use
Testing - How Vital and How Easy to useTesting - How Vital and How Easy to use
Testing - How Vital and How Easy to use
Uma Ghotikar
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
Ortus Solutions, Corp
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Tabăra de Testare
 
Robotium
RobotiumRobotium
Robotium
Isuru Uyanage
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with Jemmy
SPB SQA Group
 
Effective Android Development
Effective Android Development Effective Android Development
Effective Android Development
Sergii Zhuk
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
Bitbar
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
Roman Okolovich
 

Similar to Robotium - sampath (20)

Introduction to Robotium
Introduction to RobotiumIntroduction to Robotium
Introduction to Robotium
 
A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"A. Sirota "Building an Automation Solution based on Appium"
A. Sirota "Building an Automation Solution based on Appium"
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
 
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
LDNSE: Testdroid for Mobile App and Web Testing (London Selenium Meetup)
 
Testing in Android: automatici, di integrazione, TDD e scenari avanzati
Testing in Android: automatici, di integrazione, TDD e scenari avanzatiTesting in Android: automatici, di integrazione, TDD e scenari avanzati
Testing in Android: automatici, di integrazione, TDD e scenari avanzati
 
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
[DevDay 2016] Real Unit Testing with mocking framework - Speaker: Phat Vu – S...
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
codeduiws-130507074566782958-phpapp02.pdf
codeduiws-130507074566782958-phpapp02.pdfcodeduiws-130507074566782958-phpapp02.pdf
codeduiws-130507074566782958-phpapp02.pdf
 
Testing - How Vital and How Easy to use
Testing - How Vital and How Easy to useTesting - How Vital and How Easy to use
Testing - How Vital and How Easy to use
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API - 3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API -
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19
 
Robotium
RobotiumRobotium
Robotium
 
Automating JFC UI application testing with Jemmy
Automating JFC UI application testing with JemmyAutomating JFC UI application testing with Jemmy
Automating JFC UI application testing with Jemmy
 
Effective Android Development
Effective Android Development Effective Android Development
Effective Android Development
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
 

Recently uploaded

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 

Recently uploaded (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 

Robotium - sampath

  • 2. Session Agenda • Robotium… What is it? • Where to get it and how to set it up • “Normal” Android unit testing background • Why Robotium is needed • Using Robotium • Robotium Tips/Tricks/Issues • Complimentary tools • Further Resources • Q&A
  • 3. Robotium – what is it? • An open source test framework • Used to write black or white box tests (emphasis is on black box) • White box testing – testing software that knows and tests the internal structures or workings of an application • Black box testing – testing software functionality without knowledge of an application (perhaps where the source code is not even available) • Tests can be executed on an Android Virtual Device (AVD) or real device • Built on Java (and Android) and JUnit (the Android Test Framework) • In fact, it may be more appropriate to call Robotium an extension to the Android test framework
  • 4. Robotium Project Setup • Install and setup JDK • Install and setup Eclipse (optional) • Install and setup Android Standard Development Kit (SDK) • Supports Android 1.6 (API level 4) and above • Install and setup Android Development Tools (ADT) for Eclipse (optional) • Create Android AVD or attach device by USB • Create an Android Test Project • Download Robotium JAR and add to project classpath • robotium-solo-X.X.jar (version 3.6 the latest as of this writing) • From code.google.com/p/robotium/downloads/list
  • 5. Background-Android JUnit Testing • Android testing is based on JUnit • You create test suites, classes (test cases), methods • Organize tests into a Android Test project • No annotations • Test case classes can extend good-old-fashion JUnit3 TestCase • To call Android APIs, base class must extend AndroidTestCase • Use JUnit Assert class to check/display test results • Execute tests using an SDK provided InstrumentationTestRunner • android.test.InstrumentationTestRunner • Usually handled automatically via IDE
  • 8. The “App” Used to Demo Today Name should be in format : Last name,First name Email Should end with “.com” Should choose atleast one radio button Should contain only numbers Should choose atleast one checkbox
  • 9. Robotium Project Setup • Prerequisites • Install and setup JDK • Install and setup Eclipse (optional) • Install and setup Android Standard Development Kit (SDK) • Supports Android 1.6 (API level 4) and above • Install and setup Android Development Tools (ADT) for Eclipse (optional) • Create Android AVD or attach device by USB • Create an Android Test Project • Download Robotium JAR and add to project classpath • robotium-solo-X.X.jar (version 3.6 the latest as of this writing)
  • 11. Example Junit Test (Continued)
  • 12. Robotium Solo API • Robotium is all baked into one class - Solo – with many methods: • clickX methods: clickOnButton, clickOnImage, clickOnText,… • clickLongX methods: clickLongInList, clickLongOnScreen, clickLongOnText,… • enterText • drag • getX methods: getButton, getCurrentActivity, getImage, getEditText, … • goBack • isX methods: isCheckBoxChecked, isRadioButtonChecked,isSpinnerTextSelected, isTextChecked,… • pressX methods: pressMenuItem, pressMenuItem, pressSpinnerItem, … • scrollX methods: scrollToTop, scrollToBottom, … • searchX methods: searchButton, searchEditText, searchText, … • waitForX methods: waitForActivity, waitForText, …
  • 13. Some Robotium commands • clickOnButton(String regex) • clickInList(int line) • enterText(int index, String text) • searchText(String regex) • clickOnMenuItem(String regex) • getCurrentActivity() • goBack(), goBackToActivity(String name)
  • 14. Example Robotium commands public void testAdd() { solo.enterText(0, "5"); solo.enterText(1,"3"); solo.clickOnButton("Add"); assertTrue(solo.searchEditText("8.0")); }
  • 15. Tips / Tricks / Issues Robotium (and all JUnit tests) operate in the same process (DVM) as the original app • Robotium only works with the activities and views within the defined app • For example: Can’t use intent to launch another app and test activity work from that app The popup keyboard is accomplished with a bitmap in Android • Robotium (or any unit test software) doesn’t see the “keys” as buttons or anything.
  • 16. Tips / Tricks / Issues Use waitFor methods liberally. • Especially if new screen opens or changes to what is displayed are occurring. • The waitFor methods tell Robotium to wait for a condition to happen before the execution continues. public void testGoodLogin() { solo.enterText(0, “username"); solo.enterText(1, “password"); String label = res.getString(R.string.login_button_label); solo.clickOnButton(label); String title = res.getString(R.string.title_activity_systemv); solo.waitForText(title); solo.assertCurrentActivity("systemv", SystemVActivity.class); solo.getCurrentActivity().finish(); }
  • 17. Tips / Tricks / Issues RadioButtons are Buttons, EditText are Text, etc… • Getting the proper widget by index can be more difficult • Use of index also makes the test case more brittle due to potential layout changes • Consider clickOnButton(“Clear”) vs. clickOnButton(6)
  • 18. Tips / Tricks / Issues Resources in Android are at a premium (especially when test cases and App code are running in same DVM). • Use solo.finishOpenedActivities() in your tearDown method. • It closes all the opened activities. • Frees resources for the next tests • Robotium has some difficulty with animations • Robotium doesn’t work with status bar notifications
  • 19. Tips / Tricks / Issues Black Box Testing (when all you have is the APK file) is a little more tricky. • Recall in the demo, the test application wants the main activity name? public TestDataCollectionActivity() { super(DataCollectionActivity.class); } • You may not know this for a 3rd party/black box app. • You can get the activity name by loading the APK to an AVD or device, running it, and watching the logcat. • The APK file has to have the same certificate signature as the test project. • Probably have to delete the signature and then resign the APK with the Android debug key signature. •It’s easier than it sounds.
  • 20. Tips / Tricks / Issues • Robotium can automatically take screenshots • solo.takeScreenshot( ) • Robotium can be run from the command line (using adb shell) • adb shell am instrument -w com.android.foo/android.test.InstrumentationTestRunner • Robotium can test with localized strings • solo.getString(localized_resource_string_id) • Code coverage is a bit lackluster at this time • Can be done with special ant task and command line tools • Robotium does not work on Flash or Web apps.
  • 21. Tips / Tricks / Issues Benefits ● Easy to write, shorter code ● Automatic timing and delays ● Automatically follows current Activity ● Automatically finds Views ● Automatically makes own decisions ● when to scroll etc. ● No modification to Android platform ● Test execution is fast
  • 22. Tips / Tricks / Issues Required to know implementation details ● You often have to manually add Thread.sleep(500) to make tests work ● Large apps can be very complex to test ● Tests run slowly like if it would be done manually