Skip to content

Commit 43ae4c5

Browse files
committed
docs(websocket): add pytest dependencies and execution instructions
1 parent 6f6237a commit 43ae4c5

File tree

1 file changed

+51
-1
lines changed
  • components/esp_websocket_client/examples/target

1 file changed

+51
-1
lines changed

components/esp_websocket_client/examples/target/README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ This example can be executed on any ESP32 board, the only required interface is
1515
* Configure the websocket endpoint URI under "Example Configuration", if "WEBSOCKET_URI_FROM_STDIN" is selected then the example application will connect to the URI it reads from stdin (used for testing)
1616
* To test a WebSocket client example over TLS, please enable one of the following configurations: `CONFIG_WS_OVER_TLS_MUTUAL_AUTH` or `CONFIG_WS_OVER_TLS_SERVER_AUTH`. See the sections below for more details.
1717

18+
### Pre-configured SDK Configurations
19+
20+
This example includes several pre-configured `sdkconfig.ci.*` files for different testing scenarios:
21+
22+
* **sdkconfig.ci** - Default configuration with WebSocket over Ethernet (IP101 PHY, ESP32, IPv6) and hardcoded URI.
23+
* **sdkconfig.ci.plain_tcp** - WebSocket over plain TCP (no TLS, URI from stdin) using Ethernet (IP101 PHY, ESP32, IPv6).
24+
* **sdkconfig.ci.mutual_auth** - WebSocket with mutual TLS authentication (client/server certificate verification, skips CN check) and URI from stdin.
25+
* **sdkconfig.ci.dynamic_buffer** - WebSocket with dynamic buffer allocation, Ethernet (IP101 PHY, ESP32, IPv6), and hardcoded URI.
26+
27+
To use a specific configuration for building:
28+
```
29+
rm sdkconfig
30+
cp sdkconfig.ci.plain_tcp sdkconfig
31+
idf.py build
32+
```
33+
34+
Or specify it directly when building:
35+
```
36+
idf.py -DSDKCONFIG_DEFAULTS="sdkconfig.ci.plain_tcp" build
37+
```
38+
1839
### Server Certificate Verification
1940

2041
* Mutual Authentication: When `CONFIG_WS_OVER_TLS_MUTUAL_AUTH=y` is enabled, it's essential to provide valid certificates for both the server and client.
@@ -73,7 +94,36 @@ idf.py -p PORT flash monitor
7394

7495
(To exit the serial monitor, type ``Ctrl-]``.)
7596

76-
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
97+
See the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
98+
99+
## Testing with pytest
100+
101+
### Install Dependencies
102+
103+
Before running the pytest tests, you need to install the required Python packages:
104+
105+
```
106+
pip install -r esp-protocols/ci/requirements.txt
107+
```
108+
109+
### Run pytest
110+
111+
After installing the dependencies, you can run the pytest tests:
112+
113+
Run all tests in current directory:
114+
```
115+
pytest .
116+
```
117+
118+
Run specific test file:
119+
```
120+
pytest pytest_websocket.py
121+
```
122+
123+
To specify the target device or serial port, use:
124+
```
125+
pytest --target esp32 --port /dev/ttyUSB0
126+
```
77127

78128
## Example Output
79129

0 commit comments

Comments
 (0)