14
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

Testing Android apps with Robotium

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 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

Page 2: Testing Android apps with Robotium

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

Page 3: Testing Android apps with Robotium

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

Page 4: Testing Android apps with Robotium

Import Robotium and make an instance of Solo

shot 2012-10-24 at 09.44.40.png

Stephen Gilmore Software Engineering Large Practical

Page 5: Testing Android apps with Robotium

Write a void method whose name begins with “test”

shot 2012-10-24 at 09.44.48.png

Stephen Gilmore Software Engineering Large Practical

Page 6: Testing Android apps with Robotium

Run as an Android JUnit test

shot 2012-10-24 at 09.45.10.png

Stephen Gilmore Software Engineering Large Practical

Page 7: Testing Android apps with Robotium

The emulator appears

shot 2012-10-24 at 09.46.09.png

Stephen Gilmore Software Engineering Large Practical

Page 8: Testing Android apps with Robotium

The app under test launches

shot 2012-10-24 at 09.46.14.png

Stephen Gilmore Software Engineering Large Practical

Page 9: Testing Android apps with Robotium

Values are entered in the fields

shot 2012-10-24 at 09.46.15.png

Stephen Gilmore Software Engineering Large Practical

Page 10: Testing Android apps with Robotium

These values have been entered programmatically

shot 2012-10-24 at 09.46.16.png

Stephen Gilmore Software Engineering Large Practical

Page 11: Testing Android apps with Robotium

The button click also is performed for us

shot 2012-10-24 at 09.46.17.png

Stephen Gilmore Software Engineering Large Practical

Page 12: Testing Android apps with Robotium

All tests passed (there was only one)

shot 2012-10-24 at 09.46.21.png

Stephen Gilmore Software Engineering Large Practical

Page 13: Testing Android apps with Robotium

If some failed, we can see which

shot 2012-10-24 at 09.46.49.png

Stephen Gilmore Software Engineering Large Practical

Page 14: Testing Android apps with Robotium

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