"Turn" Android 4.0.3 CTS Test

Source: Internet
Author: User

Original URL: http://blog.csdn.net/zxm317122667/article/details/8508013

Android-cts 4.0.3 Test Basic configuration

1. Download CTS

There are two ways to obtain CTS:

1.1. Provided by Google

1.1.1. Open Browser input connection: http://source.android.com/compatibility/downloads.html

1.1.2. Download the required files

Select the CDD document corresponding to the Android version (for the CTS test), the CTS test pack download (the test package is constantly updated), android-cts-verifier-4.0.3_r1-linux_ X86-arm.zip,android-cts-media-1.0.zip

1.1.3. Basic file Structure

Unzip the downloaded CTS test package into the appropriate folder: The Android-cts folder contains Docs, Repository, tools three folders.

1.1.4. Download the Android SDK

1.2. Compiled by 4.0.3 source code

In the Android source provided by Google is included in the CTS test, the source can be seen there is a CTS folder, which is the CTS test source.

Use the command under Android project Source:

(Switch branches and keep your project source up-to-date)

./source build/envsetup.sh

Choosecombo 1 18 1 (for the company's own phone only, we choose Variant Choices:user mode here)

Make CTS

Arrived, the generated android-cts package in the ~/< source directory >/out/host/linux-x86/cts.

2. RUN CTS Pre-prep work

2.1. First determine if the Linux system's ADB path is set correctly (I simulated it under the virtual machine Ubuntu)

Shell command: (Configure environment variables)

[Email protected]:$ CD ~

[Email protected]:$ gedit. BASHRC

Add in a. bashrc file

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:

(Configured according to your own actual file path)

2.2. Ensure that the environment variables you have configured are correct

[Email protected]:$ java

[Email protected]:$ adb

See if the information is correct, if not configured, there will be a hint

(e.g. Adb:command not found)

2.3. Make sure the phone is connected properly

[Email protected]:$ adb devices

Sometimes this happens.

Workaround: Permissions issue, give root permissions and restart ADB server under root privileges.

Specific steps:

[Email protected]:$ cd Sdk/android-sdk-4.0.3/platform-tools

[Email protected]:~/sdk/android-sdk-4.0.3/platform-tools$ sudo su

[Sudo]password for Shz: (Input password, enter, root permission)

To exit Root mode:

Look, everything OK.

3. Adjusting the System state

3.1. Perform system reset, restore to factory state

3.2. APK:ADB install android-cts/repository/testcases/ctsdelegatingaccessibilityservice.apk required before testing

Then in the settings inside the auxiliary function will be one more delegating accessibility service option, this option to open

3.3. APK:ADB install android-cts/repository/testcases/ctsdeviceadmin.apk required before testing

3.4. APK:ADB install ctsverifier.apk required before testing

(Previously downloaded Android-cts-verifier-4.0.3_r1-linux_x86-arm.zip decompression has)

Then choose Device Manager for three more options in set security, tick and activate these three options

3.5. Testing media related items requires a media package that is officially available in three ways:

a). In the SD card, build the catalog test, unzip the android-cts-media-1.0.zip into the test directory, and insert the SD card into the device. Make sure the SD card is readable and writable.

b). In the Ubuntu environment, you can re-android-cts-media-1.0.zip the extracted documents in a new test folder sink, run directly under the folder

./copy_media.sh

Can.

It will automatically copy these media files to your SD card.

c). When you know your device adapts to the video resolution, use

. Copy_media.sh 1280x720

Copy the resolution and video of the resolution below to your phone's SD card for testing.

Google offers a total of five resolution video files, 176x144, 480x360, 720x480, 1280x720, 1920x1080. According to the specific situation of their own equipment, the company's mobile phone support 1080p video, but more than 720p video playback will be very card, so I tentatively choose 720p Video to test.

3.6. In Android Device settings: Security--screen protection--auto-lock set to "none"

3.7. In Android Device settings: Display--sleep time adjustment to maximum

3.8. In Android Device settings: The developer options, keep awake state, allow the analog address two tick (of course, USB debugging also need to open)

3.9. Set the language of your Android device to English.

3.10. You need a SIM card that has a normal use of the phone.

3.11. Open WiFi, connect to an available AP (my company's mobile phone is a dual sim, need to set the phone's voice, data, short message default card) settings, dual sim settings

3.12. settings, input language set to Android

3.13. The phone screen stays on the main interface

4. RUN CTS

4.1. Open terminal, enter Android-cts/tools directory

Execute command:

[Email protected]:$ cd Android-cts/tools

4.2. Enter CTS, execute cts-tradefed script

Execute command:

[Email protected]:~/android-cts/tools$:./cts-tradefed

When the phone is connected, the command will show the Android device ID, if not, the phone is not connected to the PC. Adjust the phone and PC connection, after the connection, repeat the contents of the second step and give the phone permissions:

Then repeat the previous steps to see the ID of the Android device.

Note: Sometimes enter the CTS test state can not appear cts-tf, at this time the computer press a return on it. This is a small bug in the CTS.

4.3 Starting the entire CTS test

4.3.1. First, let's take a look at the information in CTS-TF > Using the Help command:

This will show the version of the CTS test package:

Cts-tradefed Host version 4.0.3_r3

We can look at what test plan we have:

Test Packages:

There's a lot more to be posted on the back.

4.3.2. Start execution command

A) Execute a plan:run cts--plan <plan name >

Test all the commands again:

Run CTS--plan CTS

b) test only one package: Run Cts-p < Test package name >

Example: Run Cts-p android.acceleration

c) because it's based on junit testing, it's a white-box test, and basically we all know how it works inside, so we can also test it based on a specific class or method in a test package:

Run cts–p <packages name>–c <class name> [-M <method Name>]

d) Multiple Android devices simultaneously tested:

Run Cts–s device name-plan <plan name >

Note:

(1), here is a very important command

When we conduct CTS testing, there are always some unsuccessful test items due to various reasons, however, it is a time-consuming operation to fully perform the CTS test at once, this command will come in handy, it can let us test the results based on, Create a new plan based on the set of test results for Fail/not executed/time out, and then test the plan so that you can test only those projects that were not passed before, and save a lot of time without having to re-test the items that have been passed.

(2), on Google's official web site, as mentioned, when we test an entire package, the success rate is higher than a single class and method.

Therefore, when we re-test some of the failure, it is also a good choice to choose the mode of testing a package according to the situation.

5. Test results

The test results are in the Android-cts/repository/results directory;

The test log is in the Android-cts/repository/logs directory.

6. Failed project re-test and XML document integration

When we were testing some projects, we ran the CTS test completely, many of them failed fail, but when we measured these failures individually, we could not go back to the CTS again, which was time-consuming and not sure that the item would pass, so We can use the following method to the failure of the operation, to achieve the pass result of the failure of the integration.

Principle:

Change the fail entry to the not executed key and use the command to re-test.

6.1. Positioning

Find the items that test fail, modify the source code, debug it, and then test it separately until it is no longer fail. Using the text compiler to open the XML file for result, locate the item

6.2. Modifications

After the item is found, change [result= "fail"] to [result= "not Executed"], and remember that the total number of fail and not Executed are modified at the beginning of the XML file based on the number you modified

After modification:

6.3. Testing

SESSION_ID is the ID before viewing result.

Run, the test is completed, the result is integrated into the original result set, pass item will be the original fail log in the result of the XML file also deleted.

Note: The CTS test cannot do anything to the terminal.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Turn" Android 4.0.3 CTS Test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.