platformio-core: Unit Testing not working on ESP32 (test port not automatically recognized)
What kind of issue is this?
- PlatformIO Core. If you’ve found a bug, please provide an information below.
You can erase any parts of this template not applicable to your Issue.
Configuration
Operating system: Win10 x64
PlatformIO Version (platformio --version): version 5.2.1b4
Description of problem
Unit testing for an ESP32 hangs at the “Testing…” phase.
Steps to Reproduce
- Create new blank ESP32 project
- Add
test/simple_test.cppfrom below - Use the project task “Advanced -> Test”
Actual Results
Writing at 0x0003fafb... (100 %)
Wrote 210992 bytes (108452 compressed) at 0x00010000 in 3.1 seconds (effective 536.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)
(hangs forever)
Expected Results
Successfull unit test result.
If problems with PlatformIO Build System:
The content of platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
Source file to reproduce issue:
test\simple_test.cpp
#include <Arduino.h>
#include <unity.h>
void test_led_builtin_pin_number(void) {
TEST_ASSERT_EQUAL(13, 13);
}
void setup() {
delay(3000);
UNITY_BEGIN();
RUN_TEST(test_led_builtin_pin_number);
UNITY_END(); // stop unit testing
}
void loop() { }
Additional info
- The board is a standard https://www.amazon.de/ESP-32S-ESP32-Development-Bluetooth-Antennenmodul/dp/B071JR9WS9
pio testlocks up so that it can’t even killed by Ctrl+C, must be killed in the taskmanager- Increasing the
delay()does not help - Explicitly setting
test_speed = 115200does not help - Modifying
setup()toSerial.begin(115200); Serial.print("\n\n");does not help (separates bootloader output from test output) - Setting DTR / RTS states with
pio test --monitor-dtr <0/1> --monitor-rts <0/1>does not help - Pressing the reset button on the board does not help
- Looking at the serial output after the testing has been aborted at the waiting phase gives

About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (10 by maintainers)
@ivankravets
Works perfectly 💯 🥇
@ivankravets Created 4263
@HareshPrajapati
pio device listcommand?Updated