How to run unit test only in Fastlane

Viewed 444
2 Answers

Do you have a separate XCode scheme for UI and Unit tests? If it's so, you can specify a scheme to run which contains only UI/Unit tests:

run_tests(
  workspace: "App.xcworkspace",
  scheme: "MyAppUITests"
)

enter image description here enter image description here

I can make it with UI testing schema. However, I still fails on unit test scheme. i can see this kind of error in fastlane

  lane :testsunit do
    run_tests(
      scheme: "XXX_Dev_UnitTests",
      # devices: ["iPhone 7", "iPhone 12"],
      )
  end

The scheme 'XXXX_Dev_UnitTests' has nothing configured to build for Running and has no executable specified to Run. Edit the scheme to configure the Run action. [10:04:50]: Exit status: 70

enter image description here

Related