Closed daniloapr closed 4 months ago
We have not looked at unit testing in a Flutter package for a while, maybe we should.
But if you are fine with a Dart only test package, see the one in this repo for inspiration: https://github.com/objectbox/objectbox-dart/tree/main/objectbox_test
The add to project docs also have notes on how to download the C library required to run unit tests on your development machine.
Does that work for you?
Thanks for the response! Can you elaborate more on that?
What I need is to test a file in my Flutter project, which uses Object Box for data persisting, so I can ensure I'm performing the CRUD operations and complex queries properly. Would that work like that?
Looking at the Flutter unit testing docs, it appears using ObjectBox like in the test package of this repo should work. And then use flutter test
instead of dart test
. Again, have not tested that in a while.
As said, you might have to download the ObjectBox native library manually for the tests to execute. Look for the "To run unit tests on your machine" info box on the getting started page.
Or what are you missing?
Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.
Is there an existing issue?
Use case
I would like to set up ObjectBox database for tests but couldn't find any examples in the docs or in the Github repository. Is there a way to test it?
Proposed solution
Example for Isar:
Describe alternatives you've considered