Select to view content in your preferred language

Unit testing

279
1
Jump to solution
03-03-2025 06:55 AM
DjordjeNikolic
New Contributor

I am trying to reference Esri's Runtime SDK in my Flutter tests, but I am encountering the following error when running my test suite:

Invalid argument(s): Failed to load dynamic library 'example/macos/Pods/Runtimecore/Runtimecore.xcframework/macos-arm64_x86_64/Runtimecore.framework/Runtimecore'

test:

void main() { test('ArcGISMap instance should be created', () { final arcGISMap = ArcGISMap(); expect(arcGISMap, isNotNull); }); }

What is the recommended way to mock or test Esri-related functionality in Flutter?

1 Solution

Accepted Solutions
PaulSturm
Esri Contributor

Unit tests necessarily run on the "host" platform (macOS or Windows). The Maps SDK for Flutter does not support macOS or Windows, so unit tests can't be used to test the Maps SDK.

The recommended way is to use integration tests. Integration tests run on the emulator/simulator or device (iOS and Android), which makes them a little harder to deal with, but that is the only way to run our functionality (well, also "widget tests"). Note that you don't necessarily have to use the "testWidgets" method in your integration tests -- you can also use the "test" method as you would in a unit test.

https://docs.flutter.dev/testing/integration-tests

View solution in original post

0 Kudos
1 Reply
PaulSturm
Esri Contributor

Unit tests necessarily run on the "host" platform (macOS or Windows). The Maps SDK for Flutter does not support macOS or Windows, so unit tests can't be used to test the Maps SDK.

The recommended way is to use integration tests. Integration tests run on the emulator/simulator or device (iOS and Android), which makes them a little harder to deal with, but that is the only way to run our functionality (well, also "widget tests"). Note that you don't necessarily have to use the "testWidgets" method in your integration tests -- you can also use the "test" method as you would in a unit test.

https://docs.flutter.dev/testing/integration-tests

0 Kudos