Skip to content

This repository is an innovative Android application created using Kotlin and follows the principles of Clean Architecture and MVVM design pattern. The app aims to provide users with Test Cases written for the every page. It focuses on Unit Test using mockito.

Notifications You must be signed in to change notification settings

chetanvaghela457/RickyMotry_MVVM_kotlin_Unittesting_Demo

Repository files navigation

RickAndMorty App

RickAndMorty MVVM Unit Test app is built on Clean Architecture and MVVM, which shows character lists by selected locations. App includes Unit Tests over Data, Domain and, UI layers.

Test Cases

App Architecture

Architecture

App architecture design is an important consideration for ensuring that your apps are robust, testable, and maintainable.

Clean Architecture combines a group of practices that produce systems with the following characteristics:

- Testable

- UI-independent (the UI can easily be changed without changing the system)

- Independent of databases, frameworks, external agencies, and libraries

Data Layer:

Data layer includes application data and business logic. Data layer contains APIs,dto(Data Transfer Objects), repositories, source, and mappers.

Domain Layer:

Domain layer is responsible for handling business logic and sits between Ui and Data layers.Domain Layer includes usecases and entities.

Ui Layer:

Ui layer displays application data on the screen and makes Ui ready to interact with users. It contains UI-related state and Ui logic. Ui layer includes viewmodels, fragments, activities, components, states, mappers.

Importance of Mapping Data Between Layers

In-app, each layer has a data model on its own, and data is mapped between layers to each layer model. Using different models per layer is perfect for a clean architecture approach. If the app sticks to just one model and some situations like database modifications, adding restful apis to data source or needing a usable model for Ui, comes out the app needs to update all models. Using models per layer is a great key to creating scalable and maintainable software.

Tech Stack & Open Source Libraries

  • Minimum SDK level 21
  • %100 Kotlin based
  • Use Cases' purpose is to request data from repositories and turn them ready to use for the Ui layer.
  • Repository pattern is a design pattern that isolates the data layer from the rest of the app.
  • Coroutines for asynchronous programming on Android.
  • Flow is a type that can emit multiple values sequentially, as opposed to suspend functions that return only a single value In coroutines
  • ViewModel class is a business logic or screen level state holder. It exposes state to the UI and encapsulates related business logic
  • LiveData is an observable data holder class.
  • Lifecycle is a class that holds the information about the lifecycle state of a component (like an activity or a fragment) and allows other objects to observe this state.
  • Navigation Component refers to the interactions that allow users to navigate across, into, and back out from the different pieces of content within app
  • Preferences DataStore is a data storage solution that allows you to store key-value pairs.
  • Retrofit A type-safe HTTP client for Android and Java
  • Dagger Hilt Hilt provides a standard way to incorporate Dagger dependency injection into an Android application.
  • ViewBinding is a feature that allows you to more easily write code that interacts with views.
  • Coil An image loading library for Android backed by Kotlin Coroutines.
  • Extension Functions Kotlin provides the ability to extend a class or an interface with new functionality without having to inherit from the class or use design patterns

Unit Testing

  • MockWebServer A scriptable web server for testing HTTP clients
  • Mockito Mocking framework for unit tests
  • Truth is a library for performing assertions in tests:
  • Turbine is a small testing library for kotlinx.coroutines Flow.

About

This repository is an innovative Android application created using Kotlin and follows the principles of Clean Architecture and MVVM design pattern. The app aims to provide users with Test Cases written for the every page. It focuses on Unit Test using mockito.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages