Документация здесь: https://developer.android.com/topic/ Performance/benchmarking/macrobenchmark-overview
https://developer.android.com/topic/ Performance/baselineprofiles/create-baselineprofile
Но с помощью функции startActivityAndAwait я могу только открыть экран входа в систему, поэтому я не мог взаимодействовать на частном экране (экран входа в систему). Я использую Firebase Auth для входа в систему.
Код: Выделить всё
@LargeTest
@RunWith(AndroidJUnit4::class)
class SampleStartupBenchmark {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() = benchmarkRule.measureRepeated(
packageName = TARGET_PACKAGE,
metrics = listOf(StartupTimingMetric()),
iterations = DEFAULT_ITERATIONS,
setupBlock = {
// Press home button before each run to ensure the starting activity isn't visible.
pressHome()
}
) {
// starts default launch activity
startActivityAndWait()
}
}
Подробнее здесь: https://stackoverflow.com/questions/780 ... ted-screen
Мобильная версия