Unit tesing with Unity and CMake in nrf connect SDK on windows

Hello Team,

We use nrf connect sdk on windows for development.

We are trying to setup the unit tetsing environment for our project  and came across https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/test_and_optimize/test_framework/testing_unity_cmock.html .

I run the unity example with twister as described in https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/test_and_optimize/test_framework/running_unit_tests.html#running-unit-tests.

in my case the twister command looks like this "python C:\ncs\v2.7.0\zephyr\scripts\twister -T . -p qemu_cortex_m3". I have also changed the board in testcase.yml from native_posix to qemu_cortex_m3.

Q1) from my understanding its not possible to run the twister/build for native_posix in windows. Is it correct ?

After running the Twister (in my case "python C:\ncs\v2.7.0\zephyr\scripts\twister -T . -p qemu_cortex_m3"),seems like twister skips the test cases. Please see the attached screenshot.

Q2) How can i solve this issue and succesfuly run the tests ?

Q3) We also have second source project with another chip manufacturer.There also we use Zephyr. Is it possible to use the same framework(Unit testing with Unity and CMake in nrf connect SDK)  for other zephyr projects ?From my understanding  the CONFIG_UNITY in prj.conf is only available in the nrf connect sdk environment,not in Zephyr.

Q4) I have also tried to use west build and run the tes cases. Build was successfull ( west build -b qemu_cortex_m3 -p). But running throws error.

regards

Adarsh

Parents
  • Hello,

    from my understanding its not possible to run the twister/build for native_posix in windows. Is it correct ?

    Yes, you're right. The native_posix board in Zephyr is meant to run on POSIX-compliant systems like Linux or macOS. On Windows, you can use the Windows Subsystem for Linux (WSL), but it won't run directly on Windows.

    After running the Twister (in my case "python C:\ncs\v2.7.0\zephyr\scripts\twister -T . -p qemu_cortex_m3"),seems like twister skips the test cases. Please see the attached screenshot.

    From the screenshot, it seems that Twister is skipping the test cases instead of running them. I'm not entirely sure why this is happening maybe it's due to the test case configuration. I suggest double-checking the testcase.yaml file to see if there are any constraints causing the skips..

    We also have second source project with another chip manufacturer.There also we use Zephyr. Is it possible to use the same framework(Unit testing with Unity and CMake in nrf connect SDK)  for other zephyr projects ?From my understanding  the CONFIG_UNITY in prj.conf is only available in the nrf connect sdk environment,not in Zephyr

    It's true that the CONFIG_UNITY and the Unity-based unit testing framework in the nRF Connect SDK is designed specifically for the nRF ecosystem and isn't available directly in upstream Zephyr. However, I think you can still use the same general framework (Unity, CMock, CMake) for unit testing in other Zephyr-based projects, though you might need to set it up manually.

    If you'd rather use a native Zephyr solution, consider switching to ZTest, which is built into Zephyr and designed for testing on different platforms. You can check out this page from Zephyr for more details.

    Kind Regards,

    Abhijith

  • Hi Abhijith,

    Thanks for the reply..

    I have tried to run the twister with WSL Still it skips the tests. Just like in windows

    is the unity test examples from nordic(/ncs/nrf/tests/unity/example_test/) tested with Twister on nordic side ?

    Or are you guys using west to run the tests :)

    Regarding

    Adarsh

Reply Children
No Data
Related