Testing Android apps with Robotium
-
Upload
stephen-gilmore -
Category
Education
-
view
2.629 -
download
1
description
Transcript of Testing Android apps with Robotium
Software Engineering Large Practical
Testing Android apps with Robotium
Stephen Gilmore
School of Informatics, University of Edinburgh
October 24th, 2012
Stephen Gilmore Software Engineering Large Practical
News
I There will be no SELP lecture next week. Our next lecturewill be on the 7th of November.
I Reminder: the deadline for Part 1 of the SELP is tomorrow at16:00.
Stephen Gilmore Software Engineering Large Practical
Software testing
A test framework called Robotium is available for testing Androidapplications. Using Robotium we can automate tests of Androidapps, and collect statistics on which tests passed and which testsfailed, using the JUint test framework.
Stephen Gilmore Software Engineering Large Practical
Import Robotium and make an instance of Solo
shot 2012-10-24 at 09.44.40.png
Stephen Gilmore Software Engineering Large Practical
Write a void method whose name begins with “test”
shot 2012-10-24 at 09.44.48.png
Stephen Gilmore Software Engineering Large Practical
Run as an Android JUnit test
shot 2012-10-24 at 09.45.10.png
Stephen Gilmore Software Engineering Large Practical
The emulator appears
shot 2012-10-24 at 09.46.09.png
Stephen Gilmore Software Engineering Large Practical
The app under test launches
shot 2012-10-24 at 09.46.14.png
Stephen Gilmore Software Engineering Large Practical
Values are entered in the fields
shot 2012-10-24 at 09.46.15.png
Stephen Gilmore Software Engineering Large Practical
These values have been entered programmatically
shot 2012-10-24 at 09.46.16.png
Stephen Gilmore Software Engineering Large Practical
The button click also is performed for us
shot 2012-10-24 at 09.46.17.png
Stephen Gilmore Software Engineering Large Practical
All tests passed (there was only one)
shot 2012-10-24 at 09.46.21.png
Stephen Gilmore Software Engineering Large Practical
If some failed, we can see which
shot 2012-10-24 at 09.46.49.png
Stephen Gilmore Software Engineering Large Practical
Software testing
A testing framework such as Robotium allows us to formallydocument a series of tests which we expect our app to pass. Theseare embedded in the code of the test harness. After every changeto our code we can re-run the test harness and check that all testsstill pass.
Automating testing in this way can turn a boring manual taskwhich is a chore to do into a simple automatic task which is easyto re-run and operates entirely without human intervention.
Stephen Gilmore Software Engineering Large Practical