Visitar URL original
EmergePerfTesting-ios/INTEGRATION.md at main · EmergeTools/EmergePerfTesting-ios · GitHub
Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.61 KB

INTEGRATION.md

File metadata and controls

29 lines (19 loc) · 1.61 KB

Integration

There are multiple ways to integrate the EMGPerfTesting framework in a UI test bundle.

By copy-pasting

This framework is quite small, so the easiest way to include it is to just copy-paste the two files that it consists of, PerfTestRunner.swift and PerfTest.swift, into the test bundle.

By importing it manually

  • Add EMGPerfTesting.xcodeproj as a child Xcode project of the project that contains the UI test bundle target
  • Select the project that contains the UI test bundle target in the left-hand pane, then select the UI test bundle target, then go to the "Build Phases" tab
  • Find EMGPerfTesting.framework in the left-hand pane in the Products group and add it to the "Dependencies" phase
  • Add EMGPerfTesting.framework to the "Link Binary With Libraries" phase
  • Create a new "Copy Files" phase, set its Destination to "Frameworks" and add EMGPerfTesting.framework to it. Then check the "Code Sign on ..." checkbox.

At the end, it should look approximately like it does in Example/Example.xcworkspace:

Network Swizzling

Our test infrastructure depends on swizzling your application's network request/response logic to cache requests between test iterations. We've included sample code in the NetworkReplay/ folder that roughly mimicks how our caching behavior works. You can test that this caching works by copying this code into your main application and then inserting the following at the start of your app initialization:

if ProcessInfo.processInfo.environment["EMERGE_IS_PERFORMANCE_TESTING"] == "1" {
    URLSessionConfiguration.performEmergeSetup()
}