ScopeAgent pod to the test target(s) in your
Podfile. For example:
target 'MyAppTests' do pod 'ScopeAgent' end
pod install to install the agent in your project.
ScopeAgent dependency to your
cart update to install the agent in your project.
In your test target(s), add
ScopeAgent.framework located in
Carthage/Build/iOS to the
Link Binaries With Libraries build phase.
Currently, the official OpenTracing library for iOS only supports installation using Cocoapods. If you are interested in adding custom traces with OpenTracing to your app using Carthage, please use https://github.com/undefinedlabs/opentracing-objc
Instrumenting your tests
After installation, you can run your tests as you normally do, for example using the
xcodebuild test command.
Tests, network requests and application logs will be instrumented automatically.
CI provider configuration
Add the following environment variables to your test target (instructions):
After this, add the following environment variables to your CI provider:
|Environment variable||Default value||Description|
|API key to use when sending data to Scope|
|API endpoint of the Scope installation to send data to|
Local development integration
For running tests in your local Xcode installation, the following environment variables must set in your Test target (instructions):
These environment variables are set automatically by the native Scope for Mac application that you can download from the Local development/Scratchpad area of Scope.
The following command must also be run on the terminal:
defaults write com.apple.dt.Xcode UseSanitizedBuildSystemEnvironment -bool NO
After these steps, after running your tests locally in Xcode, you will get a test report in Scope with the results.
Uploading symbol files
By default, crash stack traces will be partially symbolicated. In order to fully symbolicate them and show file and line information, you must run the following script as part of your build phase for the test targets:
First, make sure your Xcode project is configured to generate the debug symbols file:
- Click on your project and select Build Settings.
- On Debug Information Format confirm DWARF with dSYM File is selected.
Select your test target from the Projects and Targets view.
Open the target's Build Phases tab.
Click + Add a new build phase, then select New Run Script Phase.
Add the following line to the Type a script text box
or the path where the Carthage folder is located.