I am developing an app that uses CoreBluetooth to communicate with a proprietary piece of hardware. I would like to be able to write tests for it, but there does not seem to be any way to mock or simulate the presence of, for example a CBPeripheral object.
This library (https://github.com/NordicSemiconductor/IOS-CoreBluetooth-Mock) almost does what I need, but it's not quite flexible enough. I think they have the right idea, but it doesn't seem to be actively maintained anymore.
This seems like a pretty big hole in the iOS SDK. Is there really not an officially supported way of testing BLE functionality?
There is no officially supported way of mocking BLE devices.
CoreBluetooth works with a lot of back and forth between the app, the Bluetooth stack, and the devices, and if you need to mock a proprietary device, you would need to implement the complete GATT protocol, and you would still be missing HCI level issues that might pop. So, you may find it more useful to conduct your tests with actual peripherals.
Argun Tekant / DTS Engineer / Core Technologies