You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guides/unit-tests.rst
+43-2Lines changed: 43 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,30 @@ DUT2 (slave) console::
84
84
Once the signal is set from DUT2, you need to press "Enter" on DUT1, then DUT1 unblocks from ``unity_wait_for_signal`` and starts to change GPIO level.
85
85
86
86
87
+
Add multiple stages test cases
88
+
-------------------------------
89
+
90
+
The normal test cases are expected to finish without reset (or only need to check if reset happens). Sometimes we want to run some specific test after certain kinds of reset.
91
+
For example, we want to test if reset reason is correct after wakeup from deep sleep. We need to create deep sleep reset first and then check the reset reason.
92
+
To support this, we can define multiple stages test case, to group a set of test functions together::
93
+
94
+
static void trigger_deepsleep(void)
95
+
{
96
+
esp_sleep_enable_timer_wakeup(2000);
97
+
esp_deep_sleep_start();
98
+
}
99
+
100
+
void check_deepsleep_reset_reason()
101
+
{
102
+
RESET_REASON reason = rtc_get_reset_reason(0);
103
+
TEST_ASSERT(reason == DEEPSLEEP_RESET);
104
+
}
105
+
106
+
TEST_CASE_MULTIPLE_STAGES("reset reason check for deepsleep", "[esp32]", trigger_deepsleep, check_deepsleep_reset_reason);
107
+
108
+
Multiple stages test cases present a group of test functions to users. It need user interactions (select case and select different stages) to run the case.
109
+
110
+
87
111
Building unit test app
88
112
----------------------
89
113
@@ -123,7 +147,7 @@ When unit test app is idle, press "Enter" will make it print test menu with all
123
147
(10) "global initializers run in the correct order" [cxx]
124
148
(11) "before scheduler has started, static initializers work correctly" [cxx]
125
149
(12) "adc2 work with wifi" [adc]
126
-
(13) "gpio master/slave test example" [ignore][misc][test_env=UT_T2_1]
150
+
(13) "gpio master/slave test example" [ignore][misc][test_env=UT_T2_1][multi_device]
0 commit comments