Unit test environment in scheme is gone?

I use ProcessInfo.processInfo.environment["key"] to get test parameters, but all of a sudden I could not find the UI like below:

In the screenshot above, the 2 environment variables were actually what I entered for the unit test target. I don't have any idea why they were moved there!

Any similar problems?

  • Please ignore my question. It should be always like this because I set "Host Application" to None in the unit test target.

Add a Comment

Accepted Reply

Hi @imneo, in recent versions of Xcode the setting you're referring to — Environment Variables — may be specified via a test plan file, and test plan files are referenced by a scheme's Test action. To customize this setting, first go to the Test action of the scheme, click the arrow next to the test plan in the list to open it in the editor, navigate to the Configurations tab, and edit the Environment Variables setting. If this is the first time you have made edits to the test plan, you may be prompted to save the file to a location in your project.

Replies

Hi @imneo, in recent versions of Xcode the setting you're referring to — Environment Variables — may be specified via a test plan file, and test plan files are referenced by a scheme's Test action. To customize this setting, first go to the Test action of the scheme, click the arrow next to the test plan in the list to open it in the editor, navigate to the Configurations tab, and edit the Environment Variables setting. If this is the first time you have made edits to the test plan, you may be prompted to save the file to a location in your project.