Xcode 15 vs. iOS: xcodebuild build-for-testing fails with linker error

The error is:

ld: building for 'iOS', but linking in dylib (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/Versions/A/XCTest) built for 'zippered(macOS/Catalyst)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And the command is following:

xcodebuild -project "my_project.xcodeproj" -scheme "UITests" -destination generic/platform=iOS build-for-testing

It's caused by updating Xcode to 15, it was working well under Xcode 14. The same UITests scheme is built and executed successfully from Xcode. And xcodebuild still builds successfully the app bundle:

xcodebuild -project "my_project.xcodeproj" -scheme "App" -destination generic/platform=iOS archive -archivePath "build/app.xcarchive"

I haven't found this problem so far in forums, so looking for help/suggestions.

Xcode 15 vs. iOS: xcodebuild build-for-testing fails with linker error
 
 
Q