Skip to main content
Associate II
July 11, 2025
Question

Unit-testing BLE features on STM32WB05KZ using Unity+mocking

  • July 11, 2025
  • 2 replies
  • 303 views

Dear all,

We are currently working with STM32WB05KZ MCU and developing unit tests for our BLE application utilizing the Unity test framework.

Specifically we are mocking scenarios such as, low-power mode pairing, and other related BLE functionalities enforcing real security measures.

We would greatly appreciate any advice or examples the following:

  1. Mocking BLE SDK functions for STM32 (e.g., ble_gap_ ble_gatts_*) using Unity or any other unit test libraries that have been successfully implemented.
  2. Injecting mocks for the STM32CubeWB BLE stack (e.g., stubs for CI, advertising, pairing testing low-power in a CI environment—any patterns practices using Unity and mock frameworks.
  3. Any repositories or reference code for unit testing for STM32WB0 series.

Thank you for support and guidance!

2 replies

OliM
Senior
July 11, 2025

If you already use Unity, I would advise you to add cmock by going to ceedling. 
Then you can happily mock away right in the specific testcases without having to explicitly build a harness
https://github.com/ThrowTheSwitch/CMock/blob/master/docs/CMock_Summary.md

vkosuriAuthor
Associate II
July 15, 2025

Thank you. Could you please provide an code for BLE mocking?

STTwo-32
Technical Moderator
August 6, 2025

Hello @vkosuri 

Officially, there is not such a public content that we can share. You may find some help on some users GitHub accounts. 

Best Regards.

STTwo-32