# How to unit test FreeRTOS code?

**URL:** <https://forums.freertos.org/t/how-to-unit-test-freertos-code/8040>\
**Category:** Kernel\
**Created:** [September 4, 2019, 6:52pm UTC](https://forums.freertos.org/t/how-to-unit-test-freertos-code/8040 "2019-09-04T18:52:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 4, 2019, 6:52pm UTC](https://forums.freertos.org/t/how-to-unit-test-freertos-code/8040/1 "2019-09-04T18:52:57Z")

</div>

**[hinashri](https://sourceforge.net/u/hinashri/)** wrote on [Wednesday, September 04, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/f380a4b245/#f2a1):

I would like to know if FreeRTOS code is unit tested or not? What is the unit testing framework used ? Could you suggest a framework that is best suited for unit testing FreeRTOS code?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 4, 2019, 7:51pm UTC](https://forums.freertos.org/t/how-to-unit-test-freertos-code/8040/2 "2019-09-04T19:51:12Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, September 04, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/f380a4b245/#f2a1/7ff9):

There is a little information on testing here:  
[https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html#Testing](https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html#Testing)  
although I note that doesn’t say that the tests are withing ‘standard  
demo’ tasks and that the Windows Simulator project is predominantly used  
for testing as it enables all the demos to run at once while  
simultaneously measuring their coverage.

What is it you wish to test? The common code or a new port layer?  
Testing port layers is a bit more involved if they include interrupt  
nesting.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 4, 2019, 9:00pm UTC](https://forums.freertos.org/t/how-to-unit-test-freertos-code/8040/3 "2019-09-04T21:00:55Z")

</div>

**[hinashri](https://sourceforge.net/u/hinashri/)** wrote on [Wednesday, September 04, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/f380a4b245/#c561):

Thanks Richard for a prompt response.  
For now we are looking into testing just common code, but may eventually need to test the port layer too.
