Xcode project scheme is not currently configured for the test action

IosXcodeUnit TestingCommand Line

Ios Problem Overview


I am trying to run an Xcode unit test for my iOS application. I am willing to do it on an iPad connected via USB to a Mac. I am trying to run the test from the command line in order to trigger it from Jenkins later on.

Below is what I'm currently typing into the command line and the error I'm getting. Please help.

The code:

xcodebuild test -scheme MyApplication -destination "platform=iOS,name=iPad"

The error:

> Scheme MyApplication is not currently configured for the test action

Ios Solutions


Solution 1 - Ios

For me the problem was that no tests were added to my scheme:

Scheme Editor

By adding test bundles to my scheme via the '+' button then the scheme could be built by Xcode and xcodebuild.

Solution 2 - Ios

For everyone struggling with this problem.

My solution was to:
  1. Select Test Target
  2. Manage Scheme
  3. Select Run in the left menu
  4. Select Info in the tab
  5. Choose Executable Target from the dropdown menu
  6. Hit Close.

Solution 3 - Ios

Fixed this up by removing duplicate schemes from Xcode. The schemes can be added/removed/shared/edited in Xcode via Product -> Scheme -> Manage Schemes.

Solution 4 - Ios

Please follow following steps to resolve this error.

  1. Select your project scheme at the top.
  2. Click on Manage Schemes.
  3. Select your test target in the popup.
  4. Make sure to click on Edit button at the bottom left of popup.
  5. Select Build.
  6. Click the checkbox below "Run"
  7. Close the popup.

Solution 5 - Ios

  • You should check your workspace data on Jenkins and see which *.xctest is already uploaded. Then you have to rename your UI/Unit test target to that *.xctest data in your xcode project like what you have on Jenkins and then push again.
  • OR wipe out your workspace from Jenkins and push all data again with new UI/Unit test target again.

(Of course you have to ensure that you have already made a scheme for project.)

Solution 6 - Ios

In my case I had no test file...

Here is a tutorial to perform UI Tests and create screenshots :

https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line

Solution 7 - Ios

My problem was that the Tests.swift file was importing a module that no longer existed (I renamed the Targets for the project). Check to make sure all test files are importing currently existing modules.

Solution 8 - Ios

I was getting this similar error, but none of the other solutions helped. Since the error was first noticed while running via Fastlane, I next ran xcodebuild manually using this command to mimic the same.

xcodebuild -workspace Noname.xcworkspace -scheme Noname -enableCodeCoverage YES build-for-testing

I then saw errors regarding: Signing for "Noname-Dependency" requires a development team.

I also so reference to a macosx signing error, which I cannot sadly reproduce having since fixed the issue.

To fix the issue, under Signing & Capabilities for the Target I selected None and then under General I unchecked Mac, as we are not needing/using that but it was selected by default when creating this new project (CocoaPod).

Oddly enough, I added back Mac and things still kept working. I think that there is a oddity with the Xcode project file and/or scheme file(s) such that when you tinker enough with it -- things get reset/fixed.

Solution 9 - Ios

I had a test plan set up (xctestplan).

  1. I needed a separate configuration for the tests (the test plan) in addition to "Shared Settings".
  2. Please also make sure that the test plan (under Xcode scheme settings) includes a test target AND a configuration.

Screenshots attached:

Test Plan

Xcode Scheme test settings

Solution 10 - Ios

Your test plan should have at least one custom configuration.

Solution 11 - Ios

  1. Go to Manage Schemes.
  2. Delete all schemes and click on Autocreate Schemes.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondanRView Question on Stackoverflow
Solution 1 - IosDavid HuntView Answer on Stackoverflow
Solution 2 - IosdanView Answer on Stackoverflow
Solution 3 - IosdanRView Answer on Stackoverflow
Solution 4 - IosTarun PunhaniView Answer on Stackoverflow
Solution 5 - IosMiladTaiView Answer on Stackoverflow
Solution 6 - IosCharlyView Answer on Stackoverflow
Solution 7 - IosKVISHView Answer on Stackoverflow
Solution 8 - IosMarkView Answer on Stackoverflow
Solution 9 - Iosinder_gtView Answer on Stackoverflow
Solution 10 - IosAleksey TsyssView Answer on Stackoverflow
Solution 11 - IosAmbesh TiwariView Answer on Stackoverflow