How to run CTS in your android device ?

1. Download CTS (Compatibility Test Suite). The version of CTS should be compatible with your device.

http://source.android.com/compatibility/downloads.html

cts-dowload2. Extract the .zip file, we have the folder “android-cts

android-cts

 3. Install 2 packages in your device: 

adb install -r android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk
adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk

how to using the command “adb” please set up as this post

4. Enable some settings : 

Settings > Accessibility > Delegating 

Delegating

Settings > Security > Device Administrators > android.deviceadmin.cts.CtsDeviceAdmin* 


administrator

5. Create a window_cts.bat file with the following content then place the bat file into the folder “tools” :

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=D:\AndroidTraining com.android.cts.tradefed.command.CtsConsole

=>Notice that: -DCTS_ROOT= {your own path},

in this case, the path in my PC is “D:\AndroidTraining\android-cts

then my own path is “D:\AndroidTraining

6. Execute the bat file, we will see the following console:

CTS init

In this console, execute the command “list devices“, it will display your device like this:

(if the command doesn’t work, you should turn off “USB debugging” option then turn on again.)

listDevCom

7. Now it is available to run CTS.

5.1 Run all CTS:

  cts-tf> run cts –plan CTS

5.2 Run class:

  cts-tf> run ctsclass <class_name>

5.3 Run package:

  cts-tf> run ctspackage <package_name>

5.4 Run method:

  cts-tf> run ctsclass <class_name> –method <method_name>

 Example:

cts-tf> run cts –class android.graphics2.cts.TextureViewTest

run a class

If it succeeds, there is a new folder (name “results“) created in :

D:\AndroiTraining\android-cts\repository\

result folder

Open the file “testResult.xml” we have the following:

resultViewHappy CTS running 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s