Manual testing in the terminal is straightforward, but you might struggle with one of the following challenges when running your program from Xcode.
Challenges
If your command-line tool defines mandatory arguments, you might feel stuck as no arguments are passed per default. Another challenge you might face is that you want to simulate that the program was started from a certain directory.
No worries. In this blog post, I will show you how to
- Pass Arguments On Launch
- Set a Custom Working Directory
Pass Arguments On Launch
Open "Edit Scheme".
You can specify the arguments passed on launch in the "Arguments" tab of the Run phase.
Set Custom Working Directory
The $(BUILD_PRODUCTS_DIR)
is used as the working directory per default. To change that, open "Edit Scheme". You can specify a custom working directory in the "Options" tab of the Run phase.