본문 바로가기

Linux

android cts 테스트 하기

안드로이드 cts 테스트 

(1) cts 실행하기 위한 선행조건

Setting up your device

CTS can be executed only on consumer devices. This section is important as not following these instructions will lead to test timeouts/ failures:

Your device should be running a user build (Android 4.0 and later)from source.android.com
     1. Please refer to this linkon the Android developer site and set up your device accordingly.
     2. Make sure that your device has been flashed with a user build (Android 4.0 and later) before you run CTS.
     3. You need to ensure the Text To Speech files are installed on the device. You can check via Settings > Speech synthesis > Install voice data before running CTS tests. (Note that this assumes you have Android Market installed on the device, if not you will need to install the files manually via adb)
     4. Make sure the device has a SD card plugged in and the card is empty. Warning: CTS may modify/erase data on the SD card plugged in to the device.
     5. Do a factory data reset on the device (Settings > storage > Factory data reset). Warning: This will erase all user data from the device.
     6. Make sure no lock pattern is set on the device (Settings > Security > Screen Lock should be 'None').
     7. Make sure the "USB Debugging" development option is checked (Settings > Developer options > USB debugging). Google Confidential
     8. Make sure Settings > Developer options > Stay Awake is checked
     9. Make sure Settings > Developer options > Allow mock locations is checked
    10. Make sure device is connected to a functioning Wi-Fi network (Settings > Wi-Fi)
    11. Make sure the device is at the home screen at the start of CTS (Press the home button).
    12. While a device is running tests, it must not be used for any other tasks.
    13. Do not press any keys on the device while CTS is running. Pressing keys or touching the screen of a test device will interfere with the running tests and may lead to test failures.
    14. Set up accessibility tests: 1. adb install android-cts/repository/testcases/ CtsDelegatingAccessibilityService.apk
    15. On the device, enable Settings > Accessibility > Delegating Accessibility Service
             1. Set up device administration tests: 1. adb install android-cts/repository/testcasesrun cts --plan CTS/CtsDeviceAdmin.apk
    16. On the device, enable Settings > Security > Device Administrators > android.deviceadmin.cts.CtsDeviceAdmin* settings
             1. Copy the CTS media files to your device using ADB with the instructions below:
    17.
        The CTS media stress tests require video clips to be on external storage (/sdcard). Most of the clips are from Big Buck Bunny which is copyrighted by the Blender Foundation under the Creative Commons Attribution 3.0license. The required space depends on the maximum video playback resolution supported by the device. By default, 176x144 and 480x360 SHOULD be supported. Note that the video playback capabilities of the device under test will be checked via the android.media.CamcorderProfile APIs.
       
        Here are the storage requirements by maximum video playback resolution:
       
        ● 480x360: 91.4MB
       
        ● 720x480: 151.9MB
       
        ● 1280x720: 401.6MB
       
        ● 920x1080: 1008.2MB
       
        Instructions to copy the media files to a device:
       
        Download the android-cts-media-X.Y.zip file compatibility/downloads.html and unzip it.
             1. Connect the device to the computer and check that adb can connect to it.
             2. cd to the unzipped folder.
             3. chmod 544 copy_media.sh
             4. Run copy_media.sh ○ To copy clips for just the default resolutions, run ./copy_media.sh. Google Confidential ○ To copy clips up to a resolution of 720x480, run ./copy_media.sh 720x480. ○ If you are not sure about the maximum resolution, try 1920x1080 so that all files are copied. ○ If there are multiple devices under adb, add -s serial option to the end. For example, to copy up to 720x480 to device with serial 1234567, run copy_media.sh 720x480 -s 1234567.
             5.
Using the CTS To run a test plan:

Make sure you have at least one device connected. Launch the CTS console by running the cts-tradefedscript e.g. $ ./android-cts/tools/cts-tradefed
     1. You may start the default test plan (containing all of the test packages) by typingrun cts --plan CTS. This will kick off all the CTS tests required for compatibility. Type list plansto see a list of test plans in the repository.Type list packages to see a list of test packages in the repository. See the CTS command reference or type helpfor a complete list of supported commands.
     2. Alternately, you can just run a CTS plan from the command line using cts-tradefed run cts --plan
     3. You should test progress and results reported on the console.


(2) 빌드 후 cts 실행 방법

make cts 해서 빌드한다.

/out/host/linux-86폴더에 cts관련 폴더가 생긴다.

out/host/linux-x86/cts폴더에 android-cts폴더와 zip파일이 생긴다.

android-cts/tools폴더가 있다

./cts-tradefed를 실행한다.

help를 치면 관련 명령어 옵션이 나온다.

run cts --plan CTS 실행하기...

run cts

run cts -c 클래스명

run cts -p 패키지명

등등

  run cts --plan test_plan_name: run a test plan
  run cts --package/-p : run a CTS test package
  run cts --class/-c [--method/-m] : run a specific test class and/ormethod
  run cts --continue-session session_ID: run all not executed tests from a previous CTS session
  run cts [options] --serial/s device_ID: run CTS on specified device
  run cts [options] --shards number_of_shards: shard a CTS run into given number of independent chunks, to run on multiple devices inparallel
  run cts --help/--help-all: get more help on running CTS


(3) 관련 cts 자료 글


정의

CTS(Compatiblity Test Suite)는 안드로이드 디바이스의 호환성을 테스트 하는 도구입니다.
안드로이드 표준 SDK에서 요구하는 API들이 존재하는지, 그리고 정상적으로 동작하는지 확인하는 것입니다.

CTS를 하는 이유는 개발자가 표준 SDK의 개발 가이드에 따라서 만든 응용 프로그램들이, CTS 인증을 받은 안드로이드 호환 디바이스에서 정상적으로 동작함을 보장하기 위함입니다.
따라서 CTS의 통과는 안드로이드 마켓에 접속하기 위한 가장 기본적인 요건입니다..
그리고 구글의 정책상 마켓 프로그램 뿐 아니라 GMS(Google Mobile Service)라고 불리우는 다양한 어플들(Gmail, Maps,Search, YouTube, etc) 역시 호환성 테스트 통과를 해야 라이선스를 받을 수 있게 되어 있습니다.

즉 다시 말하자면, CTS 테스트의 통과와 기타 CDD(Compatibility Definition Document)에 기재되어 있는 하드웨어 요구치를 충족해야만 구글의 인증을 통과하고 마켓 및 구글의 서비스를 탑재할 수 있는 것입니다.

 

구성

리눅스에서 실행되는 CTS엔진과 타겟디바이스에 설치 및 실행되는 개별 테스트 케이스들로 구성되어 있습니다.

Android 2.1(Éclair)버전은 총 23,107개의 시험 테스트 케이스로 구성되어 있으며, 테스트를 완료하는데도 상당한 시간이 걸립니다.

 

원리

Android 가 설치된 장치 와 Test 수행 PC 간에 연결이 되어 있으면 자동으로 Test App 등을 장치에서 실행하고, 그 결과를 Pass, Fail, Timeout 등으로 표시하게 됩니다.

 

테스트 과정

1.     CTS 다운로드(http://source.android.com/compatibility/downloads.html)
android-cts\tools
폴더에서 startcts 란 스크립트 파일을 열고, SDK_ROOT를 검색.
그리고 adb 파일이 위치한 곳에 지정이 되어 있는지를 확인한 후,
그렇지 않다면 adb파일 위치로 지정.
ex) PATH=${SDK_ROOT}/platform-tools:${SDK_ROOT}/tools:${PATH}

2.     테스트할 기기를 PC에 연결.

3.     기기 설정.
몇가지 준비해야 할 사항들이 있는데, Finger Print, Client ID등을 설정해주어야 함.
- SD
카드, USIM 카드 삽입, IMEI 등록
- WIFI
3G 망 접속 가능하도록 설정.
- USB
디버깅 ON
-
테스트 바이너리는 eng, user 와는 무관
- Fingerprint(
폰이 마켓에 접속할 때 인증이 되는 값) 설정
-
타겟 Data 파티션 영역이 25MB 이상인지 확인
- Data
통신이 가능한 상태인지 확인(3G,WIFI)
-
언어 영어로 변경
- Screen Timeout
30분으로 변경
- TTS
음성 데이터 설치

 

4.     CTS 실행
전체 테스트
csjung@android-buildserver2:~$sudo ./startcts
[sudo] password for p12522 :
Android CTS version 2.3_r2
Device(EF10S01110118000291) connected
cts_host > start –plan CTS


부분 테스트
cts_host > start –-plan CTS –p <java_package_name>
          ex> start –plan CTS –p android.location

Fail
항목 수정후 테스트
cts_host > start –-plan CTS –t <test pull name>
          ex> start –plan CTS –t android.app.cts.ActivityManagerMemoryInfoTest
                                                                   #testDescribeContents

Package
이름은 ls –p 로 확인 가능

간혹 adb devices 명령을 통해 기기 확인했을 때, 퍼미션이 없다고 나오는 경우에는 root 권한으로 adb server를 시작해주면 됩니다.

 

테스트 이후의 작업

1.     테스트 결과 확인
테스트의 결과는 xml 파일의 형태로 생성됨.
android-cts/repository/results/<
테스트시작 시간>/testResult.xml
result
폴더에 보면 <테스트시작 시간>.zip 파일을 볼수 있는데, 이 파일은 CTS 결과 리포트 계정을 통해 구글에 전달할 때 사용됨.
* testResult.xml
이 안열릴 경우 : 에디터로 파일을 연 후 &#(); 스트링을 찾아서 제거 후 저장.

2.     시험 결과 분석 및 디버깅
xml
파일에는 Error 종류 및 기대값, 시험값, 오류가 발생한 함수, 파일 위치가 표시
또한 xml을 에디터로 열게 되면 오류가 발생한 부분의 stack trace를 볼수 있음.

3.     결과 등록 및 구글 CTS 인증
CTS결과 서버 등록한다.
- http://sites.google.com/a/android.com/compatibility/Home

GMS launch checklist
를 작성한다.
- http://sites.google.com/a/android.com/compatibility/Home
checklist
서버 업데이트.

GMS build approval submission
를 작성한다.
- https://sites.google.com/a/google.com/gms_distribution/
-
구글에 인증을 요청한다.  - 인증 승인까지는 약 14일이 소요된다.

 

 


 

CTS 테스트 종류

Software 
- Managed API Compatibility :
달빅 실행 환경에 대한 보장 
- Soft API Compatibility  :
런타임 API에 대한 보장
-- Permissions :
모든 퍼미션 상수에 대한 지원 및 강제구조 보장
-- Build Parameters : android.os.Build
글래스 보장
-- Intent Compatibility :
인텐트 구조 보장
--- Core Application Intents :
디폴트 탑재된 애플리케이션 교체시 기존 인텐트 구조 보장 
--- Intent Overrides :
인텐트 변경을 통한 애플리케이션 차별화 금지
--- Intent Namespaces : android
패키지내의 인텐트 네임스페이스 보장
--- Broadcast Intents :
시스템에 의해 발송되는 브로드캐스트 인텐트 발송 보장
- Native API Compatibility : NDK
에서 런타임 환경 보장
- Web API Compatibility : WebView
구현물 실행 환경 보장
- API Behavioral Compatibility : Managed, Soft, Native, Web API
의 일관성 보장
- API Namespaces :
안드로이드 Java 패키지와 클래스 네임스페이스 보장
- Virtual Machine Compatibility : Dex
바이트코드 실행 보장 및 달빅 VM 보장
- User Interface Compatibility :
표준 UI API 보장
-- Widgets : "AppWidget"
의 런처내에서의 실행 보장
-- Notifications :
사운드,진동,발광,상태바 노티피케이션 지원 보장.
-- Search :
시스템 전반에 대한 검색 기능 보장.
-- Toasts :
토스트 기능 보장.
Reference Software Compatibility : 참조구현된 테스트 애플리케이션 실행 보장.
Application Packaging Compatibility : aapt로 생성한 apk 파일 설치 및 실행 보장.
Multimedia Compatibility : 안드로이드 코어 미디어 포맷에 대한 코덱 지원 보장.
Developer Tool Compatibility : adb,ddms,monkey등과 같은 개발 도구 지원 보장.
Hardware Compatibility 
- Display 
-- Standard Display Configurations :
표준 디스플레이 설정 지원 보장.
-- Non-Standard Display Configurations :
비표준 디스플레이 지원시 CTS팀에 컨택.
-- Display Metrics : android.util.DisplayMetrics
에 정확한 값 리포트.
- Keyboard : IMF
지원 및 소프트키보드 탑재, 
              android.content.res.Configuration
에 존재하지 않는 하드웨어 키보드 사용 금지 보장.
- Non-touch Navigation :
터치이외의 네비게이션 제거시, 
                          android.content.res.Configuration
에 리포트 보장.
- Screen Orientation :
동적 오리엔테이션 지원 및 기타.
- Touchscreen input :
터치스크린 포함 보장(정전용량 또는 저항막 방식 사용가능).
- USB :
표준 USB-A, 클라이언트, 호스트, USB기반 ADB, USB 대용량 스토리지, 마이크로 USB 형태 지원 등.
- Navigation keys :
,메뉴,백 기능을 하드웨어 키 및 소프트웨어 등으로 명백히 보장.
- WiFi : 802.11b
802.11g 지원 보장 및 802.11a 지원 가능.
- Camera :
최소 2 megapixels 이상의 해상도 보장 및 기타.
-- Non-Autofocus Cameras :
오토 포커스 기능 미지원시 ro.workaround.noautofocus 값 지정 및 기타.
- Accelerometer : 3
축 가속도 센서 포함 및 최소 50Hz 이벤트 보장 등.
- Compass : 3
축 나침판 포함 및 최소 10Hz 이벤트 보장 등.
- GPS : GPS
assisted GPS 포함 보장 등.
- Telephony : 
텔레포니 기능을 포함 및 포함하지 않을 수 있음.
- Bluetooth :
블루투스 포함 및 최소로 OPP, PBAP, RFCOMM, A2DP, AVCRP 프로파일 지원 보장.
- Volume controls :
볼륨 업 다운 기능 포함 및 하드웨어 또는 다양한 형태로 지원할 수 있음.
- Memory :
최소 256MB RAM 512MB 플래시 탑재 권장.
Performance Compatibility : 일정시간내의 애플리케이션 런칭타임 보장 및 동시적 애플리케이션 보장.
Security Model Compatibility : 
- Permissions :
안드로이드 퍼미션 모델 지원 보장.
- User and Process Isolation : UID
기반의 프로세스 분리 및 동일 UID기반의 복수개의 어플 샐행 보장.
- Filesystem Permissions  :
보안 및 퍼미션 기반의 파일 접근 퍼미션 지원 보장.

 문서정리