Benchmark module template manual test

Simple Java test

  1. Create a new basic Java project with an Empty Activity

  2. Right-click your project or module and select New > Module.

  3. Select benchmark module and click next.

    Benchmark module

    Expected results

    • A configure module dialog should pop up.
    • It should have the default language set to Java.
    • The minApi dropdown should not offer options below the minimum supported api level, 14.
  4. Enter a module name, a minApi, choose Java as the language and click finish.

    Expected results

    • A new module is created with the correct name, min api and latest compile / target api set.
    • It should not add kotlin to the project.
    • It should include proguard rules which are enabled by default in the module's build.gradle.
    • It should include an AndroidManifest which turns off debuggability during android tests.
    • It should be configured to use the AndroidBenchmarkRunner when running instrumented tests.
    • It should have the androidx.benchmark plugin applied.
  5. Run the sample benchmark under androidTest named ExampleBenchmark.java

    Expected results
    • The sample benchmark should run without any additional configuration as an instrumented test and report results similar to the image below.

    Sample output

Simple Kotlin test

  1. Create a new basic Kotlin project with an Empty Activity

  2. Right-click your project or module and select New > Module.

  3. Select benchmark module and click next.

    Benchmark module

    Expected results

    • A configure module dialog should pop up.
    • It should have the default language set to Kotlin.
    • The minApi dropdown should not offer options below the minimum supported api level, 14.
  4. Enter a module name, a minApi, choose Kotlin as the language and click finish.

    Expected results

    • A new module is created with the correct name, min api and latest compile / target api set.
    • It should include proguard rules which are enabled by default in the module's build.gradle.
    • It should include an AndroidManifest which turns off debuggability during android tests.
    • It should be configured to use the AndroidBenchmarkRunner when running instrumented tests.
    • It should have the androidx.benchmark plugin applied.
  5. Run the sample benchmark under androidTest named ExampleBenchmark.kt

    Expected results
    • The sample benchmark should run without any additional configuration as an instrumented test and report results similar to the image below.

    Sample output

Simple Java project with Kotlin test

  1. Create a new basic Java project with an Empty Activity

  2. Right-click your project or module and select New > Module.

  3. Select benchmark module and click next.

    Benchmark module

    Expected results

    • A configure module dialog should pop up.
    • It should have the default language set to Java.
    • The minApi dropdown should not offer options below the minimum supported api level, 14.
  4. Enter a module name, a minApi, choose Kotlin as the language and click finish.

    Expected results

    • A new module is created with the correct name, min api and latest compile / target api set.
    • It should add kotlin to the project.
    • It should include proguard rules which are enabled by default in the module's build.gradle.
    • It should include an AndroidManifest which turns off debuggability during android tests.
    • It should be configured to use the AndroidBenchmarkRunner when running instrumented tests.
    • It should have the androidx.benchmark plugin applied.
  5. Run the sample benchmark under androidTest named ExampleBenchmark.kt

    Expected results
    • The sample benchmark should run without any additional configuration as an instrumented test and report results similar to the image below.

    Sample output

Helpful Links

https://developer.android.com/studio/profile/benchmark