Skip to content

Platformio unit test runs the same test case twice #32

@lightway29

Description

@lightway29

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions