We can create new schemes to run specific configuration in Xcode. Xcode has the mechanism of creating schemes to select the configuration that we want to run. It's time to prepare environments to run this configuration. ![]() Now that, we have separate build configuration dedicated executing our unit and UI tests written with XCTest framework. We also need to add flag to the pre-processor macro. The snippet above tells CocoaPods that, we have duplicated from the debug build configuration. xcodeproj `your_project.xcodeproj`, 'xctest' => :debug We have to explicitly tells CocoaPods to create config files for build configurations in the Podfile using the current project. However, CocoaPods has created files just for debug and release configuration. As mentioned earlier, Xcode has duplicated the build configuration from the debug configuration. If you are already using CocoaPods then, there needs to do some CocoaPods specific changes. In Xcode project level setting, select the Info tab and we will see the list of available configuration and option to add more configurations Let's start with adding another build configuration for the sample iOS app from Xcode. However, UITests or XCUITests are the completely black box so we need more configurations there in order to pass the specific setups for UI tests. Generally, unit tests need less configuration as we can have access to the data and APIs directly inside the app. Now that, we will add another build configuration that can be used just for XCTest either unit or UITests. While running our unit or UI tests written using XCTest framework can still use debug configuration, however, adding another configuration gives us lot of control over our testing process. ![]() In short, build configuration is defines the mechanism how the app should be build using different conditions or settings. You can see this all over the build settings in Xcode as shown in the image above. However, we need that information for the release builds so that we can use DWARF with dSYM files setting. The build configuration defines how we want the app to be built under certain settings, e.g Debug Information Format build setting doesn't need to generate dSYM files when we develop applications using simulators so we can use DWARF for debug builds. We can always see these things in the logs. While compiling and building an iOS app, there are so many things happens under the hood e.g compiling, linking, copy bundle resource, run build scripts etc. It will have two build configurations debug and release spread all over the Build Settings of an iOS project. Imagine, we have created brand new iOS app in Xcode. Build Configurationīefore jumping into the creating new build configuration, let's see what is build configuration in iOS and why it's important to build an app with the right configuration. In this post, we will see how to create the separate build configuration for XCTest. Usually, developers use debug build configuration or running unit and UI tests but creating a separate build configuration for XCTest makes tests more independent, reliable and deterministic. As a good iOS developer, you must be writing unit and UI tests using XCTest framework. However, there are many situations that might trigger the need for more internal settings or another build configuration(s). ![]() The debug configuration is usually used for the development and internal project setting like pointing the app to test environment and release is used to submit an app to App Store. During that process, you might have heard the words like DEBUG or RELEASE configuration. When we create the new iOS project in Xcode, Apple gives us two project level build configurations i.e debug and release. Before releasing an iOS app to Apple App Store, it's very common to have a build that has been targeted to internal audience i.e QA engineers, Product Owners that will run only on specific provisioned devices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |