software engineering large practical debugging and
play

Software Engineering Large Practical Debugging and Testing Android - PowerPoint PPT Presentation

Software Engineering Large Practical Debugging and Testing Android apps Stephen Gilmore School of Informatics, University of Edinburgh November 13th, 2013 Stephen Gilmore Software Engineering Large Practical News This is the last SELP


  1. Software Engineering Large Practical Debugging and Testing Android apps Stephen Gilmore School of Informatics, University of Edinburgh November 13th, 2013 Stephen Gilmore Software Engineering Large Practical

  2. News ◮ This is the last SELP lecture. Stephen Gilmore Software Engineering Large Practical

  3. Debugging Android Apps In this lecture we consider debugging and testing our Android apps, using the Android debugger and the Android Robotium unit testing suite. We follow an example due to Lars Vogel, available at http://www.vogella.com/articles/AndroidDebugging/article.html Stephen Gilmore Software Engineering Large Practical

  4. The problem: our app should display a list of countries, but it doesn’t Stephen Gilmore Software Engineering Large Practical

  5. Getting started: Choose “Debug As” Stephen Gilmore Software Engineering Large Practical

  6. Debug configurations Stephen Gilmore Software Engineering Large Practical

  7. Switch to the “Debug” perspective to see new views such as “Variables” and “Breakpoints” Stephen Gilmore Software Engineering Large Practical

  8. Stopping at a breakpoint in the onCreate method Stephen Gilmore Software Engineering Large Practical

  9. Assigning a value to the list of countries Stephen Gilmore Software Engineering Large Practical

  10. Inspecting the value of the countries variable: an array of empty strings [””, ””, ””, ””, ””, ..., ””] Stephen Gilmore Software Engineering Large Practical

  11. Problem identified: Restart the debugging session Stephen Gilmore Software Engineering Large Practical

  12. Entering the getCountries method Stephen Gilmore Software Engineering Large Practical

  13. Continue executing, looking for updates to countries Stephen Gilmore Software Engineering Large Practical

  14. Continue execution Stephen Gilmore Software Engineering Large Practical

  15. A simple logic error is discovered: we want the country name if it is not empty Stephen Gilmore Software Engineering Large Practical

  16. We are not able to swap in the new version of the code Stephen Gilmore Software Engineering Large Practical

  17. We can terminate and relaunch this debugging session 14.59.05.png Stephen Gilmore Software Engineering Large Practical

  18. Success: a list of countries is displayed Stephen Gilmore Software Engineering Large Practical

  19. Software testing A test framework called Robotium is available for testing Android applications. Using Robotium we can automate tests of Android apps, and collect statistics on which tests passed and which tests failed, using the JUnit test framework. Stephen Gilmore Software Engineering Large Practical

  20. Import Robotium and make an instance of Solo Stephen Gilmore Software Engineering Large Practical

  21. Write a void method whose name begins with “test” Stephen Gilmore Software Engineering Large Practical

  22. Run as an Android JUnit test Stephen Gilmore Software Engineering Large Practical

  23. The emulator appears Stephen Gilmore Software Engineering Large Practical

  24. The app under test launches Stephen Gilmore Software Engineering Large Practical

  25. Values are entered in the fields Stephen Gilmore Software Engineering Large Practical

  26. These values have been entered programmatically Stephen Gilmore Software Engineering Large Practical

  27. The button click also is performed for us Stephen Gilmore Software Engineering Large Practical

  28. All tests passed (there was only one) Stephen Gilmore Software Engineering Large Practical

  29. If some failed, we can see which Stephen Gilmore Software Engineering Large Practical

  30. Software testing A testing framework such as Robotium allows us to formally document a series of tests which we expect our app to pass. These are embedded in the code of the test harness. After every change to our code we can re-run the test harness and check that all tests still pass. Automating testing in this way can turn a boring manual task which is a chore to do into a simple automatic task which is easy to re-run and operates entirely without human intervention. Stephen Gilmore Software Engineering Large Practical

Recommend


More recommend