Skip to content

Instantly share code, notes, and snippets.

@bastionkid
Created September 6, 2022 08:26
Show Gist options
  • Save bastionkid/5c0eb6c0e57049ac818dd69c12a5342d to your computer and use it in GitHub Desktop.
Save bastionkid/5c0eb6c0e57049ac818dd69c12a5342d to your computer and use it in GitHub Desktop.
Baseline Profiles Generator
@ExperimentalBaselineProfilesApi
@RunWith(AndroidJUnit4::class)
class BaselineProfileGenerator {
@get:Rule val baselineProfileRule = BaselineProfileRule()
@Test
fun startup() =
baselineProfileRule.collectBaselineProfile(packageName = YOUR_APP_PACKAGE_NAME) {
pressHome()
// This block defines the app's critical user journey. Here we are interested in
// optimizing for app startup. But you can also navigate and scroll
// through your most important UI.
startActivityAndWait()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment