RxAndroidBle
RxAndroidBle copied to clipboard
Rework `mockrxandroidble`
Summary
In the current state the mockrxandroidble
(mockclient
) is not very usable both. It does not work well with unit tests and is not really usable for substitution in a live application due to lack of possibility to manage state.
The idea is either to deprecate the mockclient
completely or to rework it so it could be used for instance with a server API
I'd love to work on this. It is actually one of my work goals :)
For our own library, we managed to create mocked remote BLE devices to be able to run end-to-end unit test and to monitor/test the BLE-requests received by remote BLE-devices. But it relies heavily on PowerMock and knowledge of the private internal implementation of the mockclient
.
The code we have is in Kotlin only and not that pretty.
Which direction would you prefer?
- Creating/updating the
mockclient
to make it work without the need for PowerMock (mockito only or through dependency injection) or - Remove the
mockclient
and modify the actual RxAndroidBle code to remove its dependency on classes such asBluetoothGattCharacteristic
, etc., and replace those by interfaces whose implementations can be injected.
Hey,
that's great!
We're planning future versions, we'll get back to you probably next week with some proposals.
Sounds good! Thank you!
When you say it doesn't work well with unit tests, do you mean the dependency on Robolectric or are there additional things to be aware of?
Robolectric
dependency is the issue for unit tests