Android 4.0.3 CTS test, android4.0.3
Android-CTS 4.0.3 test basic configuration
1. Download CTS
CTS can be obtained in two ways:
1. Provided by Google
1.1.1. Open the browser input connection: http://source.android.com/compatibility/downloads.html
1.1.2. download the required file
Bytes
1.1.3. Basic file structure
Decompress the downloaded CTS test package to the corresponding folder: the android-cts folder contains three folders: Docs, Repository, and Tools.
1.1.4. Download the android SDK
. Compiled by the 4.0.3 source code
The Android source code provided by Google contains the CTS test. The source code shows a CTS folder, which contains the CTS test source code.
Run the following command in the Android project source code:
(Switch the branch and ensure that your project source code is up-to-date)
./Source build/envsetup. sh
Choosecombo 1 18 1 (only for the company's own mobile phone, here we choose Variant choices: user Mode)
Make cts
The generated android-cts package is in ~ /<Source directory>/out/host/linux-x86/cts.
2. run cts preparations
2. 1. Check whether the adb path of the Linux system is set correctly (I simulated it under the Ubuntu virtual machine)
Shell Command: (configure environment variables)
Shz @ ubuntu: $ cd ~
Shz @ ubuntu: $ gedit. bashrc
Add
PATH = $ PATH:/home/shz/java/jdk1.6.0 _ 35/bin:
PATH = $ PATH:/home/shz/sdk/android-sdk-4.0.3/platform-tools:
PATH = $ PATH:/home/shz/sdk/android-sdk-4.0.3/tools:
(Based on your actual file path)
. Make sure that all the environment variables you configured are correct
Shz @ ubuntu: $ java
Shz @ ubuntu: $ adb
Check whether the information is correct. If not configured, a prompt is displayed.
(For example, adb: command not found)
. Make sure that your phone is correctly connected.
Shz @ ubuntu: $ adb devices
Sometimes this happens.
Solution: For permission issues, give root permission and restart the adb server with root permission.
Procedure:
Shz @ ubuntu: $ cd sdk/android-sdk-4.0.3/platform-tools
Shz @ ubuntu :~ /Sdk/android-sdk-4.0.3/platform-tools $ sudo su
[Sudo] password for shz: (enter the password, press enter, root permission)
Exit the root mode:
Look, everything is OK.
3. Adjust the system status
. Execute system reset to restore to factory status
3. 2. install apk: adb install android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk before testing.
Then there will be an additional Delegating Accessibility Service option in the auxiliary functions in the settings. Open this option.
3. install apk: adb install android-cts/repository/testcases/CtsDeviceadmin.apk before the test.
3. 4. install apk: adb install CtsVerifier.apk before testing
(Download android-cts-verifier-4.0.3_r1-linux_x86-arm.zip)
Then, choose "Set security"> "Device Manager". Select and activate the three more options.
. To test Media related items, you need to use an official media package. There are three methods:
A) Create the directory test on the SD card, decompress android-cts-media-1.0.zip to the directory test, and insert the SD card into the device. Make sure that the SD card is readable and writable.
B2.16.in the Ubuntu environment, you can store the file decompressed by android-cts-media-1.0.zip in a newly created test folder and directly run
./Copy_media.sh
You can.
It automatically copies these media files to your SD card.
C) when you know the video resolution that your device can adapt to, use
. Copy_media.sh 1280x720
Copy the video at or below the resolution to the SD card of the mobile phone for testing.
Google provides a total of five resolution video files, 176x144, 480x360, 720x480, 1280x720, 1920x1080. According to the specific situation of your device, the company's mobile phone supports a maximum of P video, but after P, the video playing will be very slow, so I tentatively set a video of P to test.
. In android device settings: Security-> screen security-> automatic lock to "NONE"
3.7. In android device settings, choose "show"> "Sleep"> "sleep time" to the maximum value.
. In android device settings: select the developer option> stay awake and allow the simulated address to be checked (of course, USB debugging also needs to be enabled)
. Set the language of the android device to English.
. You need a SIM card that can be used normally with a phone bill.
. Enable WIFI and connect to an available AP (my company's mobile phone is a dual-card, you need to set the phone's voice, data, short message default card) settings-> dual-card settings
. Settings-> set the input language to android
. The mobile phone screen stays on the main interface
4. RUN CTS
. Open the terminal and go to the android-cts/tools directory.
Run the following command:
Shz @ ubuntu: $ cd android-cts/tools
. Go to CTS and execute the cts-tradefed script.
Run the following command:
Shz @ ubuntu :~ /Android-cts/tools $:./cts-tradefed
When the mobile phone is connected, execute this command to display the Android device ID. If there is no such sentence, the mobile phone is not connected to the PC. Adjust the connection between the mobile phone and the PC. After the connection is completed, repeat the content in step 2 and grant the mobile phone permission:
Then, repeat the previous steps to see the Android device ID.
Note: Sometimes the CTS-tf cannot appear after the cts test state is entered. Press the Enter key on the computer. This is a small bug in CTS.
4.3 start the entire CTS Test
4.3.1. First, use the help command to view the information in cts-tf>:
The version of the CTS test package is displayed:
CTS-tradefed host version 4.0.3 _ r3
Let's take a look at all the test plans:
Test packages:
Many of them will not be posted later.
4.3.2. Start to execute the command
A) execute a plan: run cts -- plan <plan Name>
Test all commands:
Run cts -- plan CTS
B) test only one package: run cts-p <test package name>
Example: run cts-p android. acceleration
C) because it is based on JUnit testing and belongs to the white box testing, we basically know how it runs internally, therefore, we can also test a specific class or method in a test package:
Run cts-p <packages name>-c <class name> [-m <method name>]
D) test multiple Android devices simultaneously:
Run cts-s device name-plan <plan Name>
Note:
(1) Here is a very important command.
When we perform the CTS test, there will always be some unsuccessful test items caused by various reasons. However, it is very time-consuming to perform all the CTS tests completely, at this time, this command is useful. It can help us build on the results of our previous tests, create a new plan based on the set with the test result fail/not Executed/time out, and test the plan. You only need to test the projects that have not passed the test, it saves a lot of time without having to test the project that has passed the test again.
(2) As mentioned on Google's official website, when we test an entire package, the success rate is higher than the test of a class and method separately.
Therefore, when we re-test some failed items, it is also a good choice to test the mode of a package based on the situation.
5. Test Results
The test result is in the android-cts/repository/results directory;
The test log is in the android-cts/repository/logs directory.
6. failed project retest and xml document integration
When we test some projects, we run the CTS test completely, and many items will fail, but when we test these failed items separately, these items pass, it is impossible for us to re-run the CTS completely. This is time-consuming and cannot ensure that this item will pass. In this way, we can use the following method to operate on the failed items, integrate the pass results of failed items.
Principle:
Modify the fail item to the not Executed item and run the command to perform a retest.
6.1. Positioning
Find the items that test fail, modify and debug the source code, and then perform a separate test until it no longer fail. Use the text compiler to open the xml file of result and find the item
6.2. Modify
After finding the project, change [result = "fail"] to [result = "not Executed"], remember to modify the total number of fail and not Executed at the beginning of the xml file according to the number you modified.
After modification:
6.3. Test
Session_ID is the ID before the result.
After the test is completed, the result is integrated into the original result set. The pass item will delete the original fail log in the xml file of the result.
Note: you cannot perform any operations on the terminal during the CTS test.