https://github.com/trendyol/mockingstar-android
Mocking Star Kotlin helper library for Android applications.
https://github.com/trendyol/mockingstar-android
android interceptor mock-server okhttp-interceptor
Last synced: 3 months ago
JSON representation
Mocking Star Kotlin helper library for Android applications.
- Host: GitHub
- URL: https://github.com/trendyol/mockingstar-android
- Owner: Trendyol
- License: mit
- Created: 2023-11-22T10:41:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-25T13:42:21.000Z (10 months ago)
- Last Synced: 2025-07-18T04:36:42.323Z (6 months ago)
- Topics: android, interceptor, mock-server, okhttp-interceptor
- Language: Kotlin
- Homepage: https://trendyol.github.io/mockingstar/documentation/mockingstar/gettingstarted-android
- Size: 1.12 MB
- Stars: 39
- Watchers: 9
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Mocking Star 🌟
[](https://jitpack.io/#Trendyol/mockingstar-android)
Mocking Star is a powerful request mocking tool designed to simplify the process of http request mocking, network debugging, and using UI tests for your mobile applications. With just a single line of code, you can use Mocking Star in your project.

### Key Features
- **Mocking Requests**: Easily mock requests and test different cases with scenarios.
- **Modifying Requests**: Modify intercepted requests to test different edge cases, allowing you to assess your application's performance under different conditions.
- **Debugging Support**: Use Mocking Star to debug your network requests on your mac.
- **UI Testing**: Integrate Mocking Star into your UI tests, creating a reliable and controlled testing environment to validate your mobile application's functionality.
Mocking Star App -> [Mocking Star](https://github.com/Trendyol/mockingstar)
iOS Library -> [Mocking Star iOS Library](https://github.com/Trendyol/mockingstar-ios)
## Installation
Library is distributed through JitPack.
**Add repository to the root build.gradle**
```gradle
repositories {
maven { url("https://jitpack.io") }
}
```
**Add the library**
```gradle
implementation("com.github.Trendyol:mockingstar-android:{latest-version}")
```
You can check the latest version from the Releases
## How to Use
Library consists of an [OkHttp](https://square.github.io/okhttp/) [Interceptor](https://square.github.io/okhttp/features/interceptors/) called `MockingStarInterceptor`.
It can take two parameters:
- `MockUrlParam`: class to customize the connection url should you decide to update.
- `header`: A string map, is used to supply any custom header pair you want to add to the ongoing request.
```kotlin
class MockingStarInterceptor(
private val params: MockUrlParams = MockUrlParams(),
private val header: Map = emptyMap(),
) : Interceptor {
// Class contents
}
```
To use it, pass the `MockingStarInterceptor` to your `OkHttpClient`. After this, you can monitor the requests that are sent from your application on Mockingstar.
```kotlin
OkHttpClient.Builder()
// configuration code
.addInterceptor(MockingStarInterceptor())
.build()
```
**Warning!**
Default address to communicate with `MockingStar` application is `10.0.2.2`. This type of network access is disabled by default in Android Applications. You must add
```xml
android:usesCleartextTraffic="true"
```
to the `application` block in your `AndroidManifest.xml` to enable it.
## License
This library is released under the MIT license. See [LICENSE](LICENSE) for details.