SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
Robotium
Easy Black-box Testing
for Android
Renas Reda / Hugo Josefson
Agenda
●
Vanilla vs Robotium
– Instrumentation testing
– Write readable tests, with 10x less code [DEMO]
– (Still) access all the powers of Instrumentation [DEMO]
●
Darker than Black box [DEMO]
●
Robotium with Maven [DEMO]
●
The future of testing on Android
Black box testing?
• ...doesn't know how an application is designed
at the code level...
– bughuntress.com/analytics/glossary.html
• ...done without reference to the source code...
– www.sqablogs.com/jstrazzere/46/A+Glossary+of+Testing+Terms
.html
Instrumentation testing
Vanilla
vs
Robotium
Instrumentation Testing
(vanilla)
What's instrumentation testing?
• Investigate interaction with UI
• Pressing buttons, navigating menus
• Blackbox method(?)
• Takes time
• Can use JUnit
• Good for acceptance or system tests
• Can be automated!
Android built-in support
• Runs on device/emulator
• JUnit 3 compatible framework
• Allows direct control of user interface
–Touches
–Taps
–Scrolling in lists
• Can be started from Eclipse or shell
Android built-in support
• Tapping a view:
TouchUtils.tapView(someView)
• Pressing key (physical button):
getInstrumentation().
sendKeyDownUpSync(KeyEvent.KEYCODE_MENU)
• Sending text:
sendKeys(“some text”)
Drawbacks and limitations
• 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
– Not suitable for TDD
Setting up instrumentation tests
• Runs in emulator/device using JUnit 3
• Separate test project as normal
Writing an instrumentation test
Testing a Calculator GUI
Writing an instrumentation test
// Find views
EditText num1 = (EditText)
getActivity().findViewById(com.calculator.R.id.num1);
EditText num2 = (EditText)
getActivity().findViewById(com.calculator.R.id.num2);
Button addButton = (Button)
getActivity().findViewById(com.calculator.R.id.add_button);
// Perform instrumentation commands
TouchUtils.tapView(this, num1);
sendKeys(KeyEvent.KEYCODE_1,KeyEvent.KEYCODE_5);
TouchUtils.tapView(this, num2);
sendKeys(KeyEvent.KEYCODE_5);
TouchUtils.tapView(this, addButton);
// Fetch result and compare it against expected value
String actual = num1.getText().toString();
String expected = "20.0";
assertEquals("Addition incorrect", expected,actual);
Running instrumentation tests
• Started from Eclipse as “Android JUnit test”
• Can also be started from command line:
adb shell am instrument -w
com.package/android.test.InstrumentationTestRunner
Instrumentation testing
with
Robotium
Robotium
• Facts
– Instrumentation testing framework
– Add-on jar
– Open Source (Apache 2)
• Purpose
– Simplify making tests
• 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
• Current limitations
– Tied to JUnit 3 Instrumentation on device
– Tied to one app process
– Needs initial Activity(?)
Writing tests with Robotium
• You use only one class: Solo
• Test class like for normal instrumentation:
Remember the Calculator GUI?
Remember standard
instrumentation test?// Find views
EditText num1 = (EditText)
getActivity().findViewById(com.calculator.R.id.num1);
EditText num2 = (EditText)
getActivity().findViewById(com.calculator.R.id.num2);
Button addButton = (Button)
getActivity().findViewById(com.calculator.R.id.add_button);
// Perform instrumentation commands
TouchUtils.tapView(this, num1);
sendKeys(KeyEvent.KEYCODE_1,KeyEvent.KEYCODE_5);
TouchUtils.tapView(this, num2);
sendKeys(KeyEvent.KEYCODE_5);
TouchUtils.tapView(this, addButton);
// Fetch result and compare it against expected value
String actual = num1.getText().toString();
String expected = "20.0";
assertEquals("Addition incorrect", expected,actual);
Test Calculator with Robotium
public void testAdd() {
solo.enterText(0, "5");
solo.enterText(1,"3");
solo.clickOnButton("Add");
assertTrue(solo.searchEditText("8.0"));
}
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)
Writing Tests with Robotium
+ still access standard Instrumentation
[DEMO]
Darker than Black Box
Black box testing?
• ...doesn't know how an application is designed
at the code level...
– bughuntress.com/analytics/glossary.html
• ...done without reference to the source code...
– www.sqablogs.com/jstrazzere/46/A+Glossary+of+Testing+Terms
.html
The usual “Black box” way
• Two projects in Eclipse
– App project
– Test project
• Write test without looking at app's internals
The Darker than Black box way
• Any application's apk file
• One project in Eclipse
– App project
– Test project
• No access to original project
• Write test without any access to app's internals
Darker than Black Box
Test any APK w/o its source code
[DEMO]
Robotium with Maven
Maven
• Project management + Build tool
• Based on sane defaults
– Can be overridden with configuration
– Only configure what's different
• Plugins add functionality
– maven-android-plugin: build Android projects +
run Instrumentation tests
• Dependencies downloaded automatically
– Declare need for Robotium
→ Maven downloads jar
Declare need for Robotium
in test project
<dependency>
<groupId>com.jayway.android.robotium</groupId>
<artifactId>robotium-solo</artifactId>
<version>1.8.0</version>
</dependency>
Perform build and Run all Tests
including Robotium tests
$ mvn install
Maven with Robotium
Automating test execution
[DEMO]
The future of Testing
on Android
Google's Roadmap
?
Google's Roadmap
http://source.android.com/roadmap/
– Last entry “Beyond Q1 2009”:
– Support for WVGA and QVGA...
– Not keen on disclosing what they will /
will not release.
Google's Roadmap
http://source.android.com/roadmap/
– Last entry “Beyond Q1 2009”:
– Support for WVGA and QVGA...
– Page deleted
– Not keen on disclosing what they will /
will not release.
Robotium's Roadmap
for Instrumentation Testing
• Features we want to implement next
– Remote control
– Similar to Selenium RC
– Cucumber integration
– Generate screenshot on failure
– UI test coverage
• Features further down the line?
– Multidevice support
Robotium resources
Getting Started +
Robotium Developers discussion group:
www.robotium.org
Questions?
Robotium at Android Only 2010-09-29

Contenu connexe

Tendances

Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
Joe Ferguson
 

Tendances (20)

A guide to Android automated testing
A guide to Android automated testingA guide to Android automated testing
A guide to Android automated testing
 
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
 
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
 
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
 
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
 
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
 
Selenium interview questions and answers
Selenium interview questions and answersSelenium interview questions and answers
Selenium interview questions and answers
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics Tutorial
 
Selenium notes
Selenium notesSelenium notes
Selenium notes
 
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 android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshers
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
 
Selenium Handbook
Selenium HandbookSelenium Handbook
Selenium Handbook
 
Oh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to MutationOh so you test? - A guide to testing on Android from Unit to Mutation
Oh so you test? - A guide to testing on Android from Unit to Mutation
 

Similaire à Robotium at Android Only 2010-09-29

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 and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
Droidcon Berlin
 
2012 java one-con3648
2012 java one-con36482012 java one-con3648
2012 java one-con3648
Eing Ong
 

Similaire à Robotium at Android Only 2010-09-29 (20)

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"
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and Android
 
Building an advanced automation solution based on Appium
Building an advanced automation solution based on AppiumBuilding an advanced automation solution based on Appium
Building an advanced automation solution based on Appium
 
Android Building, Testing and reversing
Android Building, Testing and reversingAndroid Building, Testing and reversing
Android Building, Testing and reversing
 
How ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death - Second EditionHow ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death - Second Edition
 
How ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death - Second EditionHow ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death - Second Edition
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
Android testing
Android testingAndroid testing
Android testing
 
C++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the uglyC++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the ugly
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.
 
2012 java one-con3648
2012 java one-con36482012 java one-con3648
2012 java one-con3648
 
Android testing
Android testingAndroid testing
Android testing
 
When & How to Successfully use Test Automation for Mobile Applications
When & How to Successfully use Test Automation for Mobile ApplicationsWhen & How to Successfully use Test Automation for Mobile Applications
When & How to Successfully use Test Automation for Mobile Applications
 
Detox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automationDetox: tackling the flakiness of mobile automation
Detox: tackling the flakiness of mobile automation
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascript
 
Effective Android Development
Effective Android Development Effective Android Development
Effective Android Development
 
Uber Mobility Meetup: Mobile Testing
Uber Mobility Meetup:  Mobile TestingUber Mobility Meetup:  Mobile Testing
Uber Mobility Meetup: Mobile Testing
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
 
Integration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubsIntegration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubs
 
Run somke test on AWS DeviceFarm
Run somke test on AWS DeviceFarmRun somke test on AWS DeviceFarm
Run somke test on AWS DeviceFarm
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Robotium at Android Only 2010-09-29

  • 1. Robotium Easy Black-box Testing for Android Renas Reda / Hugo Josefson
  • 2. Agenda ● Vanilla vs Robotium – Instrumentation testing – Write readable tests, with 10x less code [DEMO] – (Still) access all the powers of Instrumentation [DEMO] ● Darker than Black box [DEMO] ● Robotium with Maven [DEMO] ● The future of testing on Android
  • 3. Black box testing? • ...doesn't know how an application is designed at the code level... – bughuntress.com/analytics/glossary.html • ...done without reference to the source code... – www.sqablogs.com/jstrazzere/46/A+Glossary+of+Testing+Terms .html
  • 6. What's instrumentation testing? • Investigate interaction with UI • Pressing buttons, navigating menus • Blackbox method(?) • Takes time • Can use JUnit • Good for acceptance or system tests • Can be automated!
  • 7. Android built-in support • Runs on device/emulator • JUnit 3 compatible framework • Allows direct control of user interface –Touches –Taps –Scrolling in lists • Can be started from Eclipse or shell
  • 8. Android built-in support • Tapping a view: TouchUtils.tapView(someView) • Pressing key (physical button): getInstrumentation(). sendKeyDownUpSync(KeyEvent.KEYCODE_MENU) • Sending text: sendKeys(“some text”)
  • 9. Drawbacks and limitations • 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 – Not suitable for TDD
  • 10. Setting up instrumentation tests • Runs in emulator/device using JUnit 3 • Separate test project as normal
  • 13. Writing an instrumentation test // Find views EditText num1 = (EditText) getActivity().findViewById(com.calculator.R.id.num1); EditText num2 = (EditText) getActivity().findViewById(com.calculator.R.id.num2); Button addButton = (Button) getActivity().findViewById(com.calculator.R.id.add_button); // Perform instrumentation commands TouchUtils.tapView(this, num1); sendKeys(KeyEvent.KEYCODE_1,KeyEvent.KEYCODE_5); TouchUtils.tapView(this, num2); sendKeys(KeyEvent.KEYCODE_5); TouchUtils.tapView(this, addButton); // Fetch result and compare it against expected value String actual = num1.getText().toString(); String expected = "20.0"; assertEquals("Addition incorrect", expected,actual);
  • 14. Running instrumentation tests • Started from Eclipse as “Android JUnit test” • Can also be started from command line: adb shell am instrument -w com.package/android.test.InstrumentationTestRunner
  • 16. Robotium • Facts – Instrumentation testing framework – Add-on jar – Open Source (Apache 2) • Purpose – Simplify making tests
  • 17. • 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 • Current limitations – Tied to JUnit 3 Instrumentation on device – Tied to one app process – Needs initial Activity(?)
  • 18. Writing tests with Robotium • You use only one class: Solo • Test class like for normal instrumentation:
  • 20. Remember standard instrumentation test?// Find views EditText num1 = (EditText) getActivity().findViewById(com.calculator.R.id.num1); EditText num2 = (EditText) getActivity().findViewById(com.calculator.R.id.num2); Button addButton = (Button) getActivity().findViewById(com.calculator.R.id.add_button); // Perform instrumentation commands TouchUtils.tapView(this, num1); sendKeys(KeyEvent.KEYCODE_1,KeyEvent.KEYCODE_5); TouchUtils.tapView(this, num2); sendKeys(KeyEvent.KEYCODE_5); TouchUtils.tapView(this, addButton); // Fetch result and compare it against expected value String actual = num1.getText().toString(); String expected = "20.0"; assertEquals("Addition incorrect", expected,actual);
  • 21. Test Calculator with Robotium public void testAdd() { solo.enterText(0, "5"); solo.enterText(1,"3"); solo.clickOnButton("Add"); assertTrue(solo.searchEditText("8.0")); }
  • 22. 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)
  • 23. Writing Tests with Robotium + still access standard Instrumentation [DEMO]
  • 25. Black box testing? • ...doesn't know how an application is designed at the code level... – bughuntress.com/analytics/glossary.html • ...done without reference to the source code... – www.sqablogs.com/jstrazzere/46/A+Glossary+of+Testing+Terms .html
  • 26. The usual “Black box” way • Two projects in Eclipse – App project – Test project • Write test without looking at app's internals
  • 27. The Darker than Black box way • Any application's apk file • One project in Eclipse – App project – Test project • No access to original project • Write test without any access to app's internals
  • 28. Darker than Black Box Test any APK w/o its source code [DEMO]
  • 30. Maven • Project management + Build tool • Based on sane defaults – Can be overridden with configuration – Only configure what's different • Plugins add functionality – maven-android-plugin: build Android projects + run Instrumentation tests • Dependencies downloaded automatically – Declare need for Robotium → Maven downloads jar
  • 31. Declare need for Robotium in test project <dependency> <groupId>com.jayway.android.robotium</groupId> <artifactId>robotium-solo</artifactId> <version>1.8.0</version> </dependency>
  • 32. Perform build and Run all Tests including Robotium tests $ mvn install
  • 33. Maven with Robotium Automating test execution [DEMO]
  • 34. The future of Testing on Android
  • 36. Google's Roadmap http://source.android.com/roadmap/ – Last entry “Beyond Q1 2009”: – Support for WVGA and QVGA... – Not keen on disclosing what they will / will not release.
  • 37. Google's Roadmap http://source.android.com/roadmap/ – Last entry “Beyond Q1 2009”: – Support for WVGA and QVGA... – Page deleted – Not keen on disclosing what they will / will not release.
  • 38. Robotium's Roadmap for Instrumentation Testing • Features we want to implement next – Remote control – Similar to Selenium RC – Cucumber integration – Generate screenshot on failure – UI test coverage • Features further down the line? – Multidevice support
  • 39. Robotium resources Getting Started + Robotium Developers discussion group: www.robotium.org Questions?