Platformio unit test runs the same test case twice

Open
#32 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp

Research direction

Start with platformio.ini and test_sample.cpp, then reproduce the mbed unit-test run for the lpc1768 environment using the supplied test_port and test_speed. Trace why test_numbers appears twice and determine whether the duplicate execution comes from the test setup or the platform. Done means the sample test runs once with a consistent result.

Written by the indexing model from the issue text.

Description

Trying to run a sample test case for mbed framework. Got everything working but running into an issue where the same test case runs twice and one fails and one passes.

https://community.platformio.org/t/platformio-unit-test-runs-the-same-test-case-twice/36404/3

Screenshot 2023-10-26 at 17 05 02

platformio.ini

[env:lpc1768]
platform = nxplpc
board = lpc1768
framework = mbed
test_speed = 9600
test_port = /dev/cu.usbmodem142302

test_sample.cpp

#include <mbed.h>
#include <unity.h>


#define WAIT_TIME_MS 2000

void test_numbers(void)
{
    TEST_ASSERT_EQUAL(13,13);
}



void setUp(void) {
    // set stuff up here
   
}

void tearDown(void) {
    // clean stuff up here
}


int main()
{
    thread_sleep_for(WAIT_TIME_MS);
    UNITY_BEGIN(); // IMPORTANT LINE!
    RUN_TEST(test_numbers);
    UNITY_END();

}

Folder structure

Screenshot 2023-10-26 at 17 07 02

Dominant language
Python
Stars
9
Forks
14
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from platformio/platform-nxplpc

All issues in platformio/platform-nxplpc

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.