Skip to content

Commit 811cff6

Browse files
committed
docs: explain how to run the tests
1 parent 5953a4a commit 811cff6

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Wokwi Part Tests
22

3-
This repository contains a set of test projects for many Wokwi parts. The tests can be compiled
4-
using platformio and then run using the Wokwi CLI.
3+
This repository contains a set of test projects for many Wokwi parts. The tests can be compiled using platformio and then run using the [Wokwi CLI](https://docs.wokwi.com/wokwi-ci/cli-installation).
54

65
## List of Tests
76

@@ -20,3 +19,48 @@ using platformio and then run using the Wokwi CLI.
2019
- [Arduino Uno](./wokwi-slide-potentiometer/pot-uno/)
2120
- [ESP32](./wokwi-slide-potentiometer/pot-esp32/)
2221

22+
## Running the tests
23+
24+
To build the test projects and run the tests, you need to install [PlatformIO Core](https://platformio.org/install/cli) and the [Wokwi CLI](https://docs.wokwi.com/wokwi-ci/cli-installation), get a [Wokwi CI token](https://wokwi.com/dashboard/ci) and set the `WOKWI_CLI_TOKEN` environment variable with the token.
25+
26+
Then use `pio run` to compile the project and `wokwi-cli . --scenario <scenario_file_name>.yaml` to run the tests. You can also use [Wokwi for VS Code](https://docs.wokwi.com/vscode/getting-started) to interactively simulate the test projects.
27+
28+
For example, to compile and run the tests for the `wokwi-dht22` part on the ESP32, you can use the following commands:
29+
30+
```
31+
cd wokwi-dht22/dht22-esp32
32+
pio run
33+
wokwi-cli . --scenario dht22.test.yaml
34+
```
35+
36+
The output of the test should look as follows this:
37+
38+
```
39+
Wokwi CLI v0.16.0 (ff220a404971)
40+
Connected to Wokwi Simulation API 1.0.0-0000000-g00000000
41+
Starting simulation...
42+
ets Jul 29 2019 12:21:46
43+
44+
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
45+
configsip: 0, SPIWP:0xee
46+
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
47+
mode:DIO, clock div:2
48+
load:0x3fff0030,len:1156
49+
load:0x40078000,len:11456
50+
ho 0 tail 12 room 4
51+
load:0x40080400,len:2972
52+
entry 0x400805dc
53+
[DHT22 Sensor Test (ESP32)] Expected text matched: "ets Jul 29 2019 12:21:46"
54+
DHT22 test!
55+
[DHT22 Sensor Test (ESP32)] Expected text matched: "DHT22 test!"
56+
[DHT22 Sensor Test (ESP32)] delay 500ms
57+
Humidity: 45.80% Temperature: 23.50°C
58+
[DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 45.80% Temperature: 23.50°C"
59+
[DHT22 Sensor Test (ESP32)] delay 500ms
60+
Humidity: 45.80% Temperature: 23.50°C
61+
[DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 45.80% Temperature: 23.50°C"
62+
[DHT22 Sensor Test (ESP32)] delay 500ms
63+
Humidity: 66.90% Temperature: 21.50°C
64+
[DHT22 Sensor Test (ESP32)] Expected text matched: "Humidity: 66.90% Temperature: 21.50°C"
65+
[DHT22 Sensor Test (ESP32)] Scenario completed successfully
66+
```

0 commit comments

Comments
 (0)