Could you be a bit more specific

Could you be a bit more specific for example, let say i have a function to scan devices around the area, How do we proceed to test it?
7 Replies
ZacckOsiemo
ZacckOsiemo4mo ago
So a unit test implies that you are testing that function by itself. So you would need to set it up with mocks/stubs mocking is where you provide a known response, so here you would need to mock finding a device and also not finding any devices Then check that your function responds correctly to both situations Voila! you have a unit test If you are on Zephyr still check this out https://docs.zephyrproject.org/latest/develop/test/ztest.html
ZacckOsiemo
ZacckOsiemo4mo ago
GitHub
zephyr/tests/boards/nrf/i2c/i2c_slave/src/main.c at main · zephyrpr...
Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures. - zephyrproject-rtos/zephyr
melta101
melta101OP4mo ago
Thank you!
ZacckOsiemo
ZacckOsiemo4mo ago
considering a testing live stream
melta101
melta101OP4mo ago
I would join it, Lacking a lot in that domain... would be added bonus, if you could show, how is the your thoughtprocess when attempting this via some examples
ZacckOsiemo
ZacckOsiemo4mo ago
just for you I will do one one Wednesday
melta101
melta101OP4mo ago
Damn, That would be amazing
Want results from more Discord servers?
Add your server