-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Learn from this Repo" markdown files
- Loading branch information
1 parent
bbe92ca
commit 01f2b69
Showing
17 changed files
with
378 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
# Guide to Android Instrumented Tests | ||
|
||
## Introduction to Android Instrumented Tests | ||
Android Instrumented Tests are tests that run on Android hardware or emulators, allowing developers to test the application's interface and functionality as it would operate in a real-world scenario. | ||
|
||
## Purpose of Android Instrumented Tests | ||
- **Real Environment Testing**: They provide a platform for testing the app in an environment similar to that of the end users. | ||
- **UI and Integration Testing**: Ideal for testing user interfaces and the integration between different components of the application. | ||
|
||
## Libraries Used in Android Instrumented Tests | ||
- **Espresso**: For UI testing, providing APIs to simulate user interactions and test the UI. | ||
- **JUnit**: For structuring tests and assertions. | ||
- **Mockito**: For creating mocks and stubs in tests. | ||
|
||
## Example from Provided Files | ||
### `BillsScreenTest.kt` | ||
- **Purpose**: Tests the Bills screen UI and interactions. | ||
- **Key Components**: | ||
- Using Espresso to simulate user interactions. | ||
- JUnit for assertions and test structure. | ||
|
||
### `CustomTestRunner.kt` | ||
- **Purpose**: Custom runner to set up the testing environment. | ||
- **Key Components**: | ||
- Extends AndroidJUnitRunner for custom configurations. | ||
|
||
## Best Practices for Android Instrumented Tests | ||
- **Keep Tests Isolated**: Each test should be independent of others. | ||
- **Use Mocks and Stubs**: To simulate complex objects and interactions. | ||
- **Focus on User Experience**: Test from a user's perspective, ensuring UI and functionality meet expectations. | ||
|
||
## Conclusion | ||
Android Instrumented Tests are crucial for ensuring that your app behaves correctly in a real-world environment, especially for UI and integration aspects. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# Android Unit Testing Guide | ||
|
||
## Introduction to Unit Testing in Android | ||
Unit testing is a fundamental aspect of Android development, enabling developers to validate individual units of source code. These tests help ensure that code behaves as expected, leading to more robust and reliable applications. | ||
|
||
## How Unit Testing Works in Android | ||
In Android, unit tests typically focus on the smallest unit of testable software in an application, such as classes and methods. These tests are isolated from dependencies, often utilizing mock objects to simulate real-world scenarios. | ||
|
||
## Libraries and Tools Used | ||
- **JUnit**: A framework for writing and running unit tests in Java and Kotlin. | ||
- **Mockito**: A mocking framework used to isolate units of code for testing by creating mock objects. | ||
- **Kotlin Coroutines**: Provides a way to handle asynchronous operations in testing. | ||
- **Retrofit**: A type-safe HTTP client used for testing network interactions. | ||
- **AndroidX**: Provides the `InstantTaskExecutorRule` for managing background tasks in testing. | ||
|
||
## Best Practices for Unit Testing | ||
- **Structure Your Tests Clearly**: Organize tests logically and name them descriptively. | ||
- **Use Mocks Effectively**: Utilize Mockito to create mock objects and simulate real-world scenarios. | ||
- **Handle Asynchronous Operations**: Use Kotlin Coroutines for testing asynchronous code effectively. | ||
- **Maintain Code Readability**: Write tests that are easy to read and understand. | ||
|
||
## Case Study: Analysis of Provided Kotlin Files | ||
A detailed examination of `CreditCardRepositoryImpTest.kt`, `CreditCardUseCaseImpTest.kt`, and `CreditCardViewModelTest.kt` reveals practical applications of these practices in a real-world scenario. | ||
|
||
## Conclusion | ||
Effective unit testing is crucial for developing reliable Android applications. By following best practices and utilizing the right tools, developers can ensure their code meets quality standards. | ||
|
74 changes: 74 additions & 0 deletions
74
Jetpack_Compose_Unveiled_A_Practical_Guide_through_the_Wallet_Sample_Project.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Jetpack Compose Essentials in the Wallet Sample Project | ||
|
||
## Introduction | ||
|
||
Welcome to the "Jetpack Compose Essentials in the Wallet Sample Project" guide! This document is crafted for Android developers, especially those transitioning from traditional XML-based UI development to Jetpack Compose. Jetpack Compose is Android's modern toolkit for building native UIs. It simplifies and accelerates UI development on Android with less code, powerful tools, and intuitive Kotlin APIs. | ||
|
||
In this guide, you'll learn about various Jetpack Compose components used in the Wallet Sample project. We will cover each file, highlighting the native Jetpack Compose elements, their purpose, and where they are used in the project. For each element, a link to the official documentation is provided for deeper understanding. | ||
|
||
## File Breakdowns | ||
|
||
### 1. BillOptionsComposable.kt | ||
|
||
This file defines the UI components for displaying bill options. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `Column`: Used for vertical layouts. [Documentation](https://developer.android.com/jetpack/compose/layout#column) | ||
- `Text`: Displays text. [Documentation](https://developer.android.com/jetpack/compose/text) | ||
- `Button`: Represents a clickable button. [Documentation](https://developer.android.com/jetpack/compose/button) | ||
|
||
### 2. BottomNavigationBar.kt | ||
|
||
Handles the bottom navigation bar of the app. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `BottomNavigation`: Container for the bottom navigation bar. [Documentation](https://developer.android.com/jetpack/compose/navigation#bottom-nav) | ||
- `BottomNavigationItem`: Individual items in the navigation bar. [Documentation](https://developer.android.com/jetpack/compose/navigation#items) | ||
|
||
### 3. CreditCardComposable.kt | ||
|
||
Manages the UI for displaying credit card information. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `Box`: A container for stacking elements. [Documentation](https://developer.android.com/jetpack/compose/layout#box) | ||
- `Image`: Displays images. [Documentation](https://developer.android.com/jetpack/compose/images) | ||
|
||
### 4. HomeHeaderComposable.kt | ||
|
||
Defines the header section of the home screen. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `Row`: Used for horizontal layouts. [Documentation](https://developer.android.com/jetpack/compose/layout#row) | ||
- `Icon`: Displays icons. [Documentation](https://developer.android.com/jetpack/compose/icons) | ||
|
||
### 5. LoanCardComposable.kt | ||
|
||
Creates the UI components for loan card details. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `Card`: A card layout. [Documentation](https://developer.android.com/jetpack/compose/material#card) | ||
- `Divider`: A horizontal dividing line. [Documentation](https://developer.android.com/jetpack/compose/material#divider) | ||
|
||
### 6. HomeScreen.kt | ||
|
||
The main UI for the home screen of the app. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `Scaffold`: A layout structure for Material Design. [Documentation](https://developer.android.com/jetpack/compose/layouts/material#scaffold) | ||
|
||
### 7. MainScreen.kt | ||
|
||
Manages the primary screen of the app. | ||
|
||
- **Jetpack Compose Elements:** | ||
- `NavHost`: Manages navigation within the app. [Documentation](https://developer.android.com/jetpack/compose/navigation#navhost) | ||
|
||
### 8. HomeViewModel.kt | ||
|
||
Handles the logic and data for the home screen. | ||
|
||
- **Note:** This file primarily deals with ViewModel logic and may not directly involve Jetpack Compose UI components. | ||
|
||
## Conclusion | ||
|
||
By going through this guide, you should have gained a fundamental understanding of various Jetpack Compose elements and their applications in a real-world project. The Wallet Sample project serves as a practical example to see these components in action. Remember, the official documentation is an invaluable resource for further exploration and deepening your understanding of Jetpack Compose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.