What is CTS?
Information: CDD, CTS official website, android-cts-manual-r4;
I don't have to bother with what CTS is. Just read the official statement above. However, it must be clear that your device is only possible to obtain it by complying with CDD regulations and passing CTS.AndroidTrademark and permission to the Android Market. It may be that you need to apply to Google on your own. If it is not compatible, these things will naturally come into existence.
How to use:
MATERIALS: android-cts-manual-r4, Song Lixin _ Android CTS test research;
Installation and Configuration:
Download or compile the SDK by yourself; Modify sdk_root in startcts; mount an APK on the board or emulator; Set setting;
Usage of various commands:
NOTE: For the usage of start -- Plan-P and start -- Plan-T,-T specifies a specificTestMethod
Method 1: Common method
$./Startcts note that if you useMobile phoneDevice debugging, run with root permission
Cts_host> ls -- Plan: list all plans
Out/host/linux-x86/CTS/Android-CTS/Repository/plans has the specific content of plan
Cts_host> start -- Plan VM runs a plan
Test results in the out/host/linux-x86/CTS/Android-CTS/Repository/Results directory, use the browser to view the XML file under the time directory.
Note that after the CTS is changed, make CTS must be re-compiled. If it is only compiled in the CTS directory, it cannot take effect.
Cts_host> ls-P: view the currently available use case packages
Cts_host> start -- Plan Android-P Android. app only runs a test case package, saving time
Cts_host> start -- Plan Android-P Android. app-T Android. App. CTS. alertdialogtest # testalertdialog
Only run a specific use case in a use case package
Method 2: Easy debugging in case of problems
$ ADB install out/target/product/xxxx/data/APP/sginaturetest.apk install a use case package
$ ADBShellPM list instrumentation PM is used to manage the package to see what use cases are installed on the current machine.
$ ADB shell am instrument-W Android. Tests. sigtest/. instrumentationrunner am is used to manage the activity to run a certain use case.
$ ADB shell am instrument-E class android. App. CTS. alertdialogtest # testalertdialog-W com. Android. CTS. APP/Android. Test/instrumentationctstestrunner run a small case
If an error occurs somewhere in a long Plan (such as Android) and the error message is incomplete, you need to run a small case separately, specifying the class with-e can save a lot of time
Analysis of the result after use:
The result is stored in repository/results in a folder named after the start time of the test.
There are two analysis methods:
1. You can directly find the cause from failure details (I personally think it is difficult)
2. Check the source code and failure details information to find the cause.
The second method involves finding the test source code, which requires a certain understanding of the CTS source code directory and the name of the corresponding product.
Understand the CTS project:
MATERIALS: Test and Research on Android CTS by Song Lixin; 2. Basic knowledge of Android build system, CTS source code, makefile, and shell
UnderstandingLinuxThe best starting point of the project is to start with its compilation system.
This involves the basic knowledge of Linux makefile and Android compilation systems. The specific content is still quite a lot, but I understand the android compilation system and will be handy for other android projects in the future.
Add your ownTestPackage
Document: CTS command usage and Erin YuehArticle
There are two methods:
1. Perfect Use of built-in commands (verified)
2. Using Erin Yueh
The premise of using this method is to thoroughly understand the internal structure of the CTS, otherwise you can only draw pictures
How to Write test case
MATERIALS:JUnitFive articles under SDK/docs, official website of Android Open Source/porting/instrumentation
Testing
This is another learning.
This test case may involve various layers. For the test Writing Method on the Android platform, refer to the five official articles. For how to run the test case, refer to Article 3 above,OthersIt may involve JUnit and other knowledge, and there is no field study yet.
What to understand next
1. Android compilation system (LearningMakefile and shell basic knowledge)
2. CTS Project (check whether the hypothesis of the test package XML generator is invalid and whether the project can be extracted)
3. Many levels of test case writing