检测Macrobenchmark是否正在运行

问题描述 投票:0回答:1

有没有办法检测 MacroBenchmark 何时运行?
理想情况下,我希望使用此检查来连接到在我的主机上运行的 WireMock 服务器。

android wiremock mockwebserver macrobenchmark
1个回答
0
投票

我自己想出来了。

我们可以提供带有一些额外数据的意图

@Test
fun scrollList() {
    benchmarkRule.measureRepeated(
        // ...
        setupBlock = {
            // Before starting to measure, navigate to the UI to be measured
            val intent = Intent("$packageName.RECYCLER_VIEW_ACTIVITY")
            intent.putExtra(…, …)
            startActivityAndWait(intent)
        }
    ) {
        ...
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.