How to add Android cts test cases
September 09, 2011 09:18:32 Last update: September 09, 2011 09:19:23
To add your own test cases to the Android cts suite:
If the test is not added to the
- Copy the whole
exampledirectory:cd cts/tests/tests cp -R example mytests
- Change
mytests/Android.mkto fit your needs:LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) # Replace "Example" with your name. LOCAL_PACKAGE_NAME := CtsMyTestCases # Don't include this package in any target. LOCAL_MODULE_TAGS := optional # When built, explicitly put it in the data partition. LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) # All tests should include android.test.runner. LOCAL_JAVA_LIBRARIES := android.test.runner LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SDK_VERSION := current include $(BUILD_PACKAGE)
- Add the new tests to
cts/CtsTestCaseList.mk:# These test cases will be analyzed by the CTS API coverage tools. CTS_COVERAGE_TEST_CASE_LIST := \ CtsAccessibilityServiceTestCases \ CtsAccountManagerTestCases \ CtsAppTestCases \ CtsBluetoothTestCases \ CtsContentTestCases \ CtsDatabaseTestCases \ CtsDpiTestCases \ CtsDpiTestCases2 \ CtsExampleTestCases \ CtsMyTestCases \ . . .
- Develop the tests as usual
If the test is not added to the
CTS_COVERAGE_TEST_CASE_LIST, the build will only generate the xml file for the testcases, not the apk.