Friday, October 20, 2023

Cannot read properties of undefined TestableReference

I received this error with iOS build in Microsoft App Center for Flutter app. There was 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:
<TestAction
      buildConfiguration = "Debug-qa"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES"
      shouldAutocreateTestPlan = "YES">
      <Testables>
      </Testables>
</TestAction>