Closed developer-gs closed 3 years ago
Yes, it also works with plain dart on macOS, Windows and Linux, e.g. vast majority of the lib unit tests are actually running in dart: https://github.com/objectbox/objectbox-dart/tree/main/objectbox/test
Does that help?
Thanks, I will check it out!
Just to clarify, it is not possible to unit test objectbox in a Flutter/iOS app?
What I mean is unit testing my existing Flutter/iOS code by providing a test store on the host machine.
I am trying to get a test such as in https://github.com/objectbox/objectbox-dart/tree/main/objectbox/test running. I am getting
''' Invalid argument(s): Failed to load dynamic library '/usr/local/lib/libobjectbox.dylib': dlopen(/usr/local/lib/libobjectbox.dylib, 1): image not found '''
Looking at the https://github.com/objectbox/objectbox-dart/blob/main/objectbox/pubspec.yaml there seems to be some setup for FFI required, is it possible to document this somewhere?
It is possible to unit-test. The error you're seeing is because you're missing the native library. The docs to install it are on pub.dev, docs.objectbox.io as well as in the readme in this repo.
if you're using flutter you need to add objectbox_flutter_libs
as an additional pubspec dependency. If that doesn't solve the issue for you (in your setup), you can install the native lib with the following script: bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
Works, thank you.
I suggest to add a sentence like
"In order to run unit tests with ObjectBox in Flutter, including those targeting iOS/Android, you need to install the native objectbox library for your development host. This can be done with the following script: bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
."
to the documentation. That would help. Thanks.
Updated the docs
Is it possible to run objectbox with local unit tests as it is on Android? I could not find any information on it.