Tuesday, August 21, 2012


I)What is CTS ?
II)CTS components
III)How to Run CTS from end user level?
IV)How to run CTS from Windows?
V)CTS binaries and source code structure


I)Why we need CTS ?
 
CTS testcases tests whether any android apis are modified or any changes done in android that is not compliant to android standard.
Google approves binary only when all CTS testcases are successful. For google approval process,
CTS test cases are executed on device and output .xml is sent to google team.

They will also run the CTS testcases from their end. If there is no failure, then they will approve the binary for the release.
Most of the Mobile operators will expect that the binary should be approved by google.

For some failure cases, we can get a waiver from google. For example, if it is a android DTV/Setupbox, then there wont be any GPS device in it.So all the GPS testcases will fail or not applicable for that device. Waiver request should be reasonable.

II) CTS components:
    CTS is an automated testing application that includes two major components
 1)CTS test application runs on desktop & manages test execution]
 2)Junit testcases running on Mobile or emulator or android device
  JUnit testcases are written in Java and packaged in Android.apk files to run on target device[emulator or android device].
 
III)How to run CTS from end user level?
   1.CTS can be run from Source code in linux
     
 if we have android source code, android/CTS folder will be there.
 we can compile CTS by following steps

 source build/envsetup.sh
 lunch sdk-eng
 make cts 

 Once the compilation is over, we can run
 >cts-tradefed 
 from command line.
 From cts-tradefed it will gives cts prompt.In cts prompt,
 type "list devices" to list the connected devices/emulator.You can refer the android cts document for    more information on list of commands.

 [cts-tradefed binary will be available in out/host/linux-x86/bin/cts/android-cts/tools/]
 cts-tradefed is a script file to run JUnit testcases.

     
   2.CTS can be run from downloaded binary  
         we have to download android compatiblity test suite from android site.

we have to configure this folder in PATH variable
and then we can run
 cts-tradefed in commandline.
     

 IV)How to run CTS from Windows ? Is it possible ?
      It is possible to run CTS from windows.
 Reason:
 "JUnit testcases are written in Java and packaged in Android.apk files to run on target device" from android cts manual.

 cts-tradefed is a script which will configures java to run Junit testcases.

 Configure CTS in Windows OS:

 Step1: adb path should be configured in PATH variable and "adb devices" should list down the devices.
 Step 2:
    cts-tradefed script will contains the following lines:


CTS_ROOT=${ANDROID_BUILD_TOP}/out/host/${OS}/cts
    JAR_DIR=${CTS_ROOT}/android-cts/tools
JARS="ddmlib-prebuilt.jar tradefed-prebuilt.jar hosttestlib.jar cts-tradefed.jar"

for JAR in $JARS; do
checkFile ${JAR_DIR}/${JAR}
JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
done

   java -cp ${JAR_PATH} -DCTS_ROOT=${CTS_ROOT} com.android.cts.tradefed.command.CtsConsole

Assume that I have downloaded "android-cts-4.0.3_r3-linux_x86-arm.zip"  and unzipped it

My folder structure will be as follows:D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools
The simplification of this script is as follows for windows:

java -Xmx512M -cp D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\cts-tradefed.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\hosttestlib.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\ddmlib-prebuilt.jar;D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts\tools\tradefed-prebuilt.jar -DCTS_ROOT=D:\android-cts-4.0.3_r3-linux_x86-arm\   com.android.cts.tradefed.command.CtsConsole

run this command in commandline then you will get cts prompt in windows OS too.

-cp is the class search path for the zip or jar files. whenever some class is encountered in jar file,java will look for it in class search path.
CTS_ROOT will be used internally in jar files, so we are setting CTS_ROOT by -DCTS_ROOT.
CTS_ROOT is D:\android-cts-4.0.3_r3-linux_x86-arm. not a D:\android-cts-4.0.3_r3-linux_x86-arm\android-cts.[by giving this, i got errors]


V) CTS Binaries & source code structure:
          1)cts-tradefed.jar source code path is "android_source_path/cts"
 2)hosttestlib.jar
 3)Junit.tar
          4)ddmlib-prebuilt.jar
          5)tradefed-prebuilt.jar

 ddmlib-prebuilt.jar and tradefed-prebuilt.jar is available as prebuilt binaries. No source code available

 tradefed-prebuilt.jar is a CTS component runs on Desktop machine and manages test execution. platform/tools/tradefederation is the source code folder path for tradefed-prebuilt.jar file.














     

Labels: , , , ,

0 Comments:

Post a Comment

<< Home