Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Model is the underlying business logic, the view interacts with the user and the controller exposes the model to the outside world. It's important to note that the model is not the domain model (a java objects used to save and retrieve data from the database).

From the illustration above the view is not dumb because it can also communicate with the model. The lack of clear separation of concerns between the view and the model makes this design unsuitable for writing unit testingtests.


Model View Presenter (MVP)

...

The clear separation of concerns between the view and the model makes this design pattern ideal for testing. Unit tests for the two component can be easily created by (Presenter and Model) is simply done by either mocking the view or the presenter.

Although MVP pattern is simple and easy to implement, there are various ways to do this. We have discussed this and came up with our customized versions version of MVP as OpenSRP developers. 

...

Please check them out and if possible feel free to add your sample mvp application there.

Instrumentation Tests

These tests check how the application works in real life. They run on an android device or emulator. Running them before a release may be better than adding them to our continuous integration tool (Travis). This is because they take longer to execute compared to unit tests and may require external services (Server, Dabase) to be working correctly. 


The best way to write these tests is to automate QA checklist. The Quality Assurance team develop a checklist or testing scripts that they validate before a release. Automating the test scripts will reduce time spent manually testing everything and quickly identify regression bugs. 


Expresso has been idenfied as the tool to be used for automating the QA checklist.

References

https://developer.android.com/studio/test/

...

https://android.jlelse.eu/android-mvp-for-beginners-25889c500443

https://panavtec.me/say-goodbye-to-all-main-thread-problems-in-mvp