How to run a XCode UI test with a Flutter project

I have developed a very basic App using various frameworks. My iOS native version runs fine and I’m able to run some automated UI tests via XCode.

I’ve written the same app using Flutter and I can run it on my iPhone device without problems. Now I want to use the same UI tests I’ve already used for iOS native for the Flutter app too. Therefore I did the same as with the native app and created a new UI test target and wrote my test cases. The problem here is that when running the tests, the build process failes with the error

ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Why can’t XCode find the framework? When just running the app itself, it works fine. PATH is set, Flutter Doctor says everything is fine, flutter run from the terminal works too.

There is also a file named ‘Generated.xcconfig’ where all the paths to Flutter are set correctly:

// This is a generated file; do not edit or check into version control. FLUTTER_ROOT=/Users/pau...rg/Library/Flutter FLUTTER_APPLICATION_PATH=/Users/pau...rg/Desktop/M...eit_APPS/04_Flutter_PerformanceTests FLUTTER_TARGET=/Users/pau....rg/Desktop/M....eit_APPS/04_Flutter_PerformanceTests/lib/main.dart FLUTTER_BUILD_DIR=build SYMROOT=${SOURCE_ROOT}/../build/ios OTHER_LDFLAGS=$(inherited) -framework Flutter FLUTTER_FRAMEWORK_DIR=/Users/pau....rg/Library/Flutter/bin/cache/artifacts/engine/ios FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1 TRACK_WIDGET_CREATION=true

How to tell XCode where to find Flutter for the test cases? Is it even possible to use those automated UI tests in XCode for iOS Apps developed with other frameworks like ReactNative, Flutter, Ionic,…?