Skip to content

zakir01913/AndroidTesting

Repository files navigation

Android Testing Sample

This is a sample to showcase how to write unit test case and UI test case in Android by using JUnit, Espresso and Mockito with RxJava, Android Architecture Component and Dagger2.

Functionality

Home screen shows users, stored in database in RecyclerView and a floating add button. User can insert into database new user by clicking the floating button.

Implementation

Dependency Injection

Dependency injection is accomplished through Dagger2 for both main and test apk build. Custom testInstrumentationRunner is user for testing.

UI Test

Espresso and Mockito are used for UI test. Test covers the following functionalities:

  • Display user list - user list is properly displayed in RecyclerView
  • Add user - error message is showing for invalid data.
  • Delete user - user list item is remove from RecyclerView
  • Select user - display user details.

Persistence Layer Test

Room database is used for persistence layer. Room in-memory database is used for tasting persistence layer code.

Unit test

Mockito and Junit are used for unit test.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages