idf-eclipse-plugin icon indicating copy to clipboard operation
idf-eclipse-plugin copied to clipboard

IEP-1649 Add SWT Tests to Verify ESP-IDF Terminal in the IDE

Open sigmaaa opened this issue 2 months ago • 2 comments

Description

Please include a summary of the change and which issue is fixed.

Fixes # (IEP-XXX)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

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

Dependent components impacted by this PR:

  • Component 1
  • Component 2

Checklist

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

Summary by CodeRabbit

  • Tests
    • Added an automated UI test for the Terminal view that initializes the UI test environment, opens the Terminal, selects the ESP-IDF terminal, types and runs the idf.py --version command, redirects output to a temporary file, waits for completion, verifies the output contains the expected "IDF v" version string, and ensures temporary files and the Terminal view are cleaned up.

sigmaaa avatar Oct 20 '25 10:10 sigmaaa

Walkthrough

Adds a new SWTBot-based JUnit UI test class that opens the Eclipse Terminal view, runs idf.py --version redirected to a temporary file via simulated key events, reads the file, asserts it contains "IDF v", and cleans up.

Changes

Cohort / File(s) Change Summary
Terminal View UI Test
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/TerminalViewTest.java
New public test class TerminalViewTest annotated with @RunWith(SWTBotJunit4ClassRunner.class); adds @BeforeClass setup() and @AfterClass cleanup() and @Test testOpenTerminalView() that initialize SWTBot, open the Terminal view (handling multiple toolbar tooltips), create/delete a temporary file, send canvas key events to run idf.py --version > <temp>, wait/poll for completion, read the temp file, and assert its contents contain "IDF v".

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Test as TerminalViewTest
    participant SWTBot as SWTBot Harness
    participant Terminal as Terminal View (Canvas)
    participant Temp as Temp File

    Note over Test,SWTBot: Setup
    Test->>SWTBot: initialize SWTBot environment (`@BeforeClass`)
    SWTBot-->>Test: ready

    Note over Test,Terminal: Open terminal & prepare
    Test->>Terminal: open Terminal view, select ESP-IDF Terminal
    Terminal-->>Test: view opened / canvas available

    Note over Test,Temp: Create temp file
    Test->>Temp: create temporary file
    Temp-->>Test: path

    Note over Test,Terminal: Execute command
    Test->>Terminal: send key events: type "idf.py --version > <temp>" + Enter
    Terminal->>Temp: write command output (async)

    Note over Test,Temp: Verify output
    Test->>Temp: poll/read contents
    Temp-->>Test: contents

    Test->>Test: assert contains "IDF v"
    Test->>Temp: delete temp file

    Note over Test,SWTBot: Cleanup
    Test->>SWTBot: close Terminal view if open (`@AfterClass`)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Potential focus areas:

  • SWTBot UI timing/wait logic and flakiness points.
  • Temp file creation/cleanup and platform-specific path handling.
  • Canvas key-event simulation correctness.

Suggested reviewers

  • alirana01
  • kolipakakondal

Poem

🐰 I tapped the canvas with tiny paws,
Typed a short command to follow the laws,
Output hopped into a file with delight,
"IDF v" peeked out in the soft test light,
A rabbit's small cheer for the build's quiet rites.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding SWT tests for the ESP-IDF Terminal in the IDE, which aligns with the new TerminalViewTest class added in the changeset.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch IEP-1649

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 20 '25 10:10 coderabbitai[bot]

@sigmaaa hi !

LGTM 👍

AndriiFilippov avatar Oct 24 '25 08:10 AndriiFilippov