Configuring tests in Soong builds

Android.mk

android_test

Android.bp

android_test { name: "HelloWorldTests", srcs: ["src/**/*.java"], sdk_version: "current", static_libs: ["android-support-test"], certificate: "platform", test_suites: ["device-tests"], }





android_test

android_app

Mapping tests in the source tree

TEST_MAPPING

TEST_MAPPING

TEST_MAPPING

{

"presubmit": [

{

"name": "CtsAccessibilityServiceTestCases",

"options": [

{

"include-annotation": "android.platform.test.annotations.Presubmit"

}

]

}

],

"postsubmit": [

{

"name": "CtsWindowManagerDeviceTestCases"

}

],

"imports": [

{

"path": "frameworks/base/services/core/java/com/android/server/am"

}

]

}

Running tests locally with Atest





atest [optional-arguments] test-to-run





atest test-to-run-1 test-to-run-2





LOCAL_MODULE

LOCAL_PACKAGE_NAME

Android.mk

Android.bp





For example:

atest FrameworksServicesTests

atest CtsJankDeviceTestCases

Discovering tests with Atest and TEST MAPPING

Go to the directory containing the TEST_MAPPING file. Run the command: atest

All presubmit tests configured in the TEST_MAPPING files of the current directory and its parent directories are run. Atest will locate and run two tests for presubmit.

Finding more testing documentation



