I got this error with iOS build in Microsoft App Center for Flutter app. There were flavors configured with dev, qa and prod envs. The dev.xcscheme and qa.xcsheme under Runner.xcodeproj/xcshareddata/xcschemes should have Testables under TestAction. Otherwise it will throw Cannot read properties of undefined (reading 'TestableReference') error. The code should look like:

      buildConfiguration = "Debug-qa"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES"
      shouldAutocreateTestPlan = "YES">

When we open the project in Xcode, <Testables></Testables> gets automatically removed. Without this App Center build will fail.