Skip to content

Commit 2e472f8

Browse files
espresso mock server
1 parent a7c71b9 commit 2e472f8

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

docs/espresso-mock-server.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
id: espresso-mock-server
3+
title: Espresso Mock Server
4+
sidebar_label: Mock Server
5+
description: Now you can run your Espresso mock server on LambdaTest online grid of 3000+ real desktop browsers and real operating systems with its supported capabilities.
6+
keywords:
7+
- espresso
8+
- java
9+
- mock server
10+
- lambdatest java
11+
- framework on lambdatest
12+
- testng
13+
- app testing
14+
- real devices
15+
image: /assets/images/og-images/appium-testing-og-image.jpg
16+
url: https://www.lambdatest.com/support/docs/espresso-mock-server/
17+
site_name: LambdaTest
18+
slug: espresso-mock-server/
19+
---
20+
21+
import CodeBlock from '@theme/CodeBlock';
22+
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
23+
24+
<script type="application/ld+json"
25+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
26+
"@context": "https://schema.org",
27+
"@type": "BreadcrumbList",
28+
"itemListElement": [{
29+
"@type": "ListItem",
30+
"position": 1,
31+
"name": "Home",
32+
"item": "https://www.lambdatest.com"
33+
},{
34+
"@type": "ListItem",
35+
"position": 2,
36+
"name": "Support",
37+
"item": "https://www.lambdatest.com/support/docs/"
38+
},{
39+
"@type": "ListItem",
40+
"position": 3,
41+
"name": "Espresso Mock Server",
42+
"item": "https://www.lambdatest.com/support/docs/espresso-mock-server"
43+
}]
44+
})
45+
}}
46+
></script>
47+
Espresso Mock Server (also known as MockWebServer from Square) lets you simulate server responses in your Android tests. You can control exactly what response an API call gets—status code, headers, body, delay, etc.
48+
49+
## Capability Support
50+
51+
To enable Espresso Mock Server in your LambdaTest Espresso tests, you must set the following desired capability:
52+
53+
```java
54+
"enableWifi": true
55+
```
56+
57+
This capability allows the Android emulator to expose internal ports to communicate with a mock server (e.g. MockWebServer) running within your test environment. This is helpful when your app communicates with a mock server running on a specific port within the emulator, and you want to control the server’s responses during testing.
58+
59+
## Limitation
60+
Using `enableWifi: true` comes with the following restrictions:
61+
62+
You cannot use it in combination with other networking capabilities like:
63+
64+
- `network`
65+
- `dedicatedProxy`
66+
- `geoLocation`
67+
- `tunnel`
68+
69+
Make sure to remove these if you're enabling the mock server capability.

sidebars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,6 +2653,11 @@ module.exports = {
26532653
label: "JUnit Report",
26542654
id: "espresso-junit-report",
26552655
},
2656+
{
2657+
type: "doc",
2658+
label: "Espresso Mock Server",
2659+
id: "espresso-mock-server"
2660+
}
26562661
],
26572662
],
26582663

0 commit comments

Comments
 (0)