Android device CTS test is hard. Developing Android device test takes a long time. Here are some tools and instructions to accelerate Android device test development and debug.
- Cannot run CTS on Windows 10. Try this script
- No good IDE for CTS test module, and build CTS takes long time. Create an Android Studio project for a CTS test module, e.g. CtsSampleDeviceTestCases to develop build and debug.
- Some CTS tests have a short run time, makeing manualy atatching debugger impossible. We can manual run test and attatch debugger using command lines
- Difficult to explore edit and debug CTS Verifier source code. Solution: ctsVerifier Android Studio project
Debug CTS test APK with Android Studio
- Debug with the APK directly.
- Create and debug the Android Studio project.
- Build and debug the Android Studio project.
- Manually run a test case to allow manually attatch debugger.
Android Studio allows debuging an APK without the building. Before you start, make sure you have Setup CTS to run.
Open Android Studio, File> Profile or debug APK. Pick an APK form the testcases folder, and let Android Studio do it's work. After that is done, go to the activity that you want to debug and click on the atatch java/kolin source
After that is done, you should be able to set a breakpoint and debug the Java code like such.
It is easier to develope and debug with Android Studio. CTS is open source, it is possible to do so. However, CTS uses a different build system. You can create Android Studio Build configuration file to develope and debug the test module.
Examples:
Here is what it looks like after it's built

Here are links to downloading source files in this project. The following are all CTS 9.0_R11
To download, click tgz and unzip to your workspace
The following is a visualisation of a project
- Master
- Branch for 1.0
- Tag 1.0.1
- Tag 1.0.3
- Tag 1.0.4
- Branch for 2.0
- Tag 2.0.1 ...
- Branch for 1.0
If one just clones the release files, they could end up with a different tag, leading to more problems. Hence the need to specify CTS 9.0_R11

