The Play framework has very specific test support - facilitated by the JUnit libraries. This enables Play applications to be launched in test mode and specific simple tests executed on the application classes.
We examine how the MyRent app is refactored into a client-service pair, the service being deployed either locally or on the cloud.
Play Framework support for JUnit is used to create a simple set of tests run against MyRent service.
The Retrofit HTTP client is integrated into the MyRent Android client app to provide an effective communications channel with the MyRent service.
Here we implement an API. It comprises a set of routes (the end points), controllers for these routes together with the means of translating Java objects to and from the Json format.
Explore the Unit test features of Play by writing some tests to verify the current behavior of the Residence model class for the MyRent app. Develop a test app to consume MyRent service API, progressively implementing a range of functionality in writing to and reading from the service database.
In a previous lab we introduced an SQLite database. This allows us to retain a local copy of the data. Here we integrate the Retrofit REST client to facilitate manipulation of server-based data. The local and remote data are kept in sync. Testing is performed against localhost and Heroku deployed databases.