You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

UI测试执行完成后Xcode未生成memgraph文件,如何解决?

UI测试执行后Xcode未生成memgraph文件的解决疑问

我正在学习WWDC 2021的《Detect and diagnose memory》视频,视频中提到UI测试执行完毕后会自动生成memgraph文件。我创建了新项目并添加了UI测试,但测试完成后,我的Xcode 14.2并未生成任何memgraph文件。

以下是参照视频示例编写的测试代码:

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

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

            startMeasuring()

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

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

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

            XCTAssertTrue(true)
        }
    }

我已经尝试过以下操作:

  • 在UI Test scheme中取消勾选“Attachments: Delete when each test succeeds”
  • 勾选了“Malloc Stack Logging”

请问该如何设置才能让Xcode在UI测试执行完成后生成memgraph文件?

内容的提问来源于stack exchange,提问作者Hoang Anh Tuan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 17:27:31