Mocking out libmm-glib for testing
Jessy Exum
jessy.diamondman at gmail.com
Wed Jun 2 00:45:51 UTC 2021
Hello everyone,
I have been working on a C++ project that uses libmm-glib, but I recently
ran into an issue around testing it. I was hoping to be able to create an
artificial MMSim (not based on a real card) and pass that to my code under
test. My main goal is to avoid dbus dependencies so I can directly
instrument the 'external' data types in my tests. It seemed like it was
going to be reasonably easy:
1. Make a directory to hold my wrappers.
2. Create my own libmm-glib.h that imports the core enum and error
header files.
3. Create my own GObject based MMSim class for instrumentation.
4. Do some clever stuff with include paths so my tests pull in my
libmm-glib.h but my libmm-glib.h pulls in the ModemManager
ModemManager-enums.h/etc files.
But I realized I would lose access to all of libmm-glib's other types. I
would have to reimplement types like MMBearerProperties (which is already a
basic data type that needs no modification for testing).
Does anyone know a better way to do this? I have found details on
Aleksander's blog about how to test ModemManager, but I have not yet come
up with much on how to test code that uses ModemManager. Any advice would
be greatly appreciated.
Thank you all for your time,
Jessy Diamond Exum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20210601/611e4d35/attachment-0001.htm>
More information about the ModemManager-devel
mailing list