XCTest doesn't generate memgraph file after UI test finish execution


I'm following this video Detect and diagnose memory from WWDC 2021: Detect and diagnose memory issues - WWDC21 - Videos - Apple Developer

In the video, after the UI test finishes execution, a memgraph is generated.
I tried to created a new project and added some UI tests, but after all the tests finished execution, Xcode didn't generate any memgraph.

Here is my test that follows the example in WWDC video:

func testExample() throws {
        // UI tests must launch the application that they test.
        let app = XCUIApplication()
        let options = XCTMeasureOptions()
        options.invocationOptions = [.manuallyStart]

            metrics: [XCTMemoryMetric(application: app)],
            options: options
        ) {


            app.staticTexts["Abandoned Memory Example"].tap()

            app.staticTexts["Leaks Memory Example"].tap()

            let simulateLogoutThenLoginActionButton = app.buttons["Simulate Logout then Login Action"]


What I've tried:

  • In UI Test scheme, I unchecked the "Attachments: Delete when each test succeeds"
  • I checked "Malloc Stack Logging"
  • I tried using the command line: "xcodebuild test -project ... -scheme ... -destination ... -enablePerformanceTestsDiagnotics YES"

I'm using Xcode 14.2.

How can I make Xcode generate a memgraph after UI test finishes execution? Thanks in advance for your help!

We get the memgraph on running the UITests via xcodebuild command and on passing the following parameter:
-enablePerformanceTestsDiagnostics YES

The memgraph is attached as a part of each UITest and is a part of the XCResult file generated at the end of test. This is generally the last step in the test recorded in the xcresult file.

Attached below is a screenshot for reference.

1 Like