Flutter Unable to find a target named RunnerTests in project Runner.xcodeproj, did find Runner.

4 min read

This error occurs when running tests in a Flutter project with Xcode. The solution is to add a new target called "RunnerTests" to the Xcode project. To do this, follow these steps:

  1. Open the Runner.xcodeproj in Xcode.
  2. Click on the "Runner" project in the left sidebar.
  3. Go to File > New > Target.
  4. Select "iOS Unit Testing Bundle" under the "Test" category and click Next.
  5. Name the target "RunnerTests" and click Finish.
  6. In the "General" tab of the "RunnerTests" target settings, change the "Host Application" to "Runner".
  7. Run the tests again and the error should be resolved.