简体   繁体   中英

How to run CTS tests in android(Eclair)?

为了向市场发布设备,您需要运行android给定的兼容性测试套件...我需要知道如何下载和运行它。

As XC said in a comment, as of 2.0, the CTS is freely available.

For it to be runnable, you have to build the tests. In your top level android directory, do all the normal build set-up steps and then

make cts

Then in the out/host/linux-x86/cts/android-cts/tools sub directory, you will find the startcts bash script. I expect the location might depend on what platform you are building on. Modify it to point out your SDK and then run the script. It is relatively self explanatory.

Thanks for all the guides and links above that helps me to setup the CTS successfully.

I using - Android CTS v2.3_r8

I summarize the steps here for those who wish to get CTS up on Windows.

  1. Install cygwin here: http://www.cygwin.com

  2. I placed android-cts in my cygwin folder eg C:\\cygwin\\home\\Username\\ . You may set up accordingly if you have placed it elsewhere.

  3. Create new Environment Variables to point to SDK_ROOT and CTS_ROOT directories

    1. Go to Control panel->System -> Advanced tab
    2. Click on Environment variables
    3. Click on New to add CTS_ROOTS to system variables and add the path of android-cts to its value
    4. Do the same for SDK_ROOT and add the path of andriod-sdk to its value
  4. Go to android-cts\\tools and modify 2 lines in the startcts script file as follows [With help from How to run Android's CTS on windows on an emulator but some slight modification that works for me

     JARS="$(cygpath -w -p ${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB}:${HOSTTEST_LIB})" java ${JAVA_OPTS} -cp ${JARS} com.android.cts.TestHost "$(cygpath -w "${CONFIG}")" "$@" ${DDCONFIG} 

Save startcts as Unix file. I use dos2unix.exe downloaded from http://waterlan.home.xs4all.nl/dos2unix.html to convert it to Unix file.

Then, to run CTS

  1. Attach android device to PC

  2. (a) Go to cmd prompt, type adb install -r android-cts/repository/testcases/CtsDeviceAdmin.apk

  3. (b) On the device, enable all the android.deviceadmin.cts.* device administrators under Settings > Location & security > Select device administrators

  4. Run cygwin and go to android-cts/tools

  5. Execute Android CTS by ./startcts

For how to run the tests in CTS, I refer again to section Working with CTS in the link given the earlier comment by cezio "using-androids-compatibility-test-suite"

As of ICS (4.0), cts has had a bit of a makeover. Now it's called cts-tradefed .

The Google-provided documentation is available here .

For a simple way to get up to speed on using cts-tradefed from your AOSP root directory and a connected device with a matching AOSP build:

make cts
cd out/host/$OSDIR/cts/android-cts/tools
./cts-tradefed

Here, $OSDIR is either linux-x86 , darwin-x86

in the cts-shell:

help
list packages
list plans
run cts --plan CTS
run cts --package android.webkit

If it's not obvious, you can also use one of the plans or packages listed from list packages or list plans . Hopefully this will be helpful to someone else. It would've been quite helpful for me to find it earlier.

There is a quite good documentation on Android's source website. Also, some time ago I've wrote small crash course on CTS .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM