Skip to content

Conversation

brianignacio5
Copy link
Collaborator

Description

Remove dependency to pytest, read serial output directly to parse unit test results.

This pull request introduces a new infrastructure for running ESP-IDF unit tests using the Unity test framework over a serial connection. The main changes include implementing a serial port capture utility, a Unity test output parser, and a test runner that orchestrates the process. The existing unit test adapter is refactored to use these new components, enabling more robust and accurate test execution and reporting directly from the device.

Serial communication and Unity test orchestration:

  • Added UnitySerialCapture class to handle serial communication with ESP32 devices, including connecting, capturing output, performing hardware resets, and sending commands to the device.
  • Implemented UnityTestRunner class to manage the test execution flow, interact with the serial capture, and parse test results from device output.

Unity test result parsing and types:

  • Added UnityParser class for parsing Unity test framework output into structured test result objects, supporting both individual and multiple test results.
  • Defined TypeScript interfaces for Unity test results, suites, summaries, and serial port configuration in types.ts.

Integration with existing unit test adapter:

  • Refactored adapter.ts to use the new Unity test runner, including serial port selection, baud rate configuration, and improved error handling for test execution. [1] [2]
  • Updated imports and dependencies in adapter.ts to support new functionality. [1] [2]

Type of change

  • New feature (non-breaking change which adds functionality)

Steps to test this pull request

Configure a ESP-IDF project with unit tests. Review unit-testing

  1. Click on "Unit testing tab"
  2. On a test, click the run button.
  3. Observe results.
  • Expected behaviour:

Test should be executed without pytest. Output is shown in test output.

  • Expected output:

How has this been tested?

Manual testing as described above.

Test Configuration:

  • ESP-IDF Version: 5.5.1
  • OS (Windows,Linux and macOS): macOS

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

@brianignacio5 brianignacio5 self-assigned this Sep 26, 2025
Copy link

github-actions bot commented Sep 26, 2025

Download the artifacts for this pull request:
You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

Copy link

Pull request has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities

Copy link
Collaborator

@radurentea radurentea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment regarding the use of "console" for warnings and errors instead of using "Logger" and noticed some console.logs as well

Copy link
Collaborator

@Fabricio-ESP Fabricio-ESP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed Working on Windows, Ubuntu and MacOS environment.
It is a quicker interface to run the unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants