IMHO, the basic Bluetooth interfaces are ideal for unit testing. All delegate callbacks are accepted by the manager and the corresponding parameters, so if you follow the template in which you use these arguments, instead of the internal state, you can pass whatever you want. Using mock objects is the best way to do this. During unit testing, you should not try to scoff at the behavior of managers. You should focus on checking how your code interacts with the API and nothing more.
Packers can respond better to integration tests. But in fact, integration testing of Core Bluetooth code is best done manually for my experience. The stack is not stable enough to provide reliable testing, and the test code should also be strengthened against stack errors, which is really difficult, because, obviously, they are not documented or unpredictable, just looking at the API. Although, on the other hand, your test code will also have to model the erroneous behavior of the stack. There may be times when this is possible, but the test code will be just as complex, if not more so than the one you are testing.
source share