2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
자동화된 CTS 테스트 실행(Android 11 이상)
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
자동화된 CTS 테스트를 실행하는 방법은 두 가지가 있습니다.
이 페이지에서는 Trade Federation을 사용하여 자동화된 테스트를 실행하는 방법을 설명합니다. OmniLab Android 테스트 하네스를 사용하여 테스트를 실행하는 방법에 관한 안내는 OmniLab Android 테스트 스테이션을 참고하세요.
모든 자동화된 CTS 테스트 실행
Trade Federation에는 테스트를 실행하기 위한 명령줄 인터페이스인 CTS 콘솔이 포함되어 있습니다. 자동화된 CTS 테스트 모음 전체를 실행하려면 다음 단계를 따르세요.
- 자동화된 CTS 테스트 설정의 안내를 따랐는지 확인합니다.
테스트 워크스테이션에서 CTS 패키지가 압축 해제된 폴더의 cts-tradefed
스크립트를 실행하여 CTS 콘솔을 시작합니다.
./android-cts/tools/cts-tradefed
CTS 콘솔에 CTS 명령어(cts-tradefed >
)를 입력할 수 있는 커서가 표시됩니다.
cts
테스트 계획에는 자동화된 CTS 테스트가 모두 포함되어 있습니다. cts
테스트 계획을 실행하려면 다음 명령어를 실행합니다.
run cts
자동화된 CTS 테스트가 실행됩니다. 다음 내용을 참고하세요.
Android 13 이상에서는 멀티 디바이스 테스트를 지원합니다. 이러한 테스트는 샤딩이 사용될 때만 자동으로 실행됩니다. 샤딩에 관한 자세한 내용은 테스트 실행 시간 개선을 참고하세요. 이러한 테스트를 수동으로 실행하려면 멀티 디바이스 테스트 실행을 참고하시기 바랍니다.
CTS를 실행할 때마다 Ctrl+C를 눌러 기존 CTS 콘솔을 중지한 후 CTS 콘솔을 다시 실행합니다.
단일 호스트에서 여러 CTS 버전을 실행할 수는 없습니다. 각 버전이 기존의 공개 위치 코드(OLC) 서버를 사용하여 열리기 때문입니다.
테스트 결과를 확인합니다. 자세한 내용은 CTS 결과 해석을 참고하세요.
테스트 실행이 이번이 처음이라면 제어할 수 없는 문제로 인해 실패하는 테스트가 있을 수 있습니다. 예를 들어 네트워크 연결이 느리거나 GPS 신호가 약할 수 있습니다. 모든 테스트 모듈이 완료되고 테스트 실패 수가 마지막 두 번의 재시도 세션에서 동일할 때까지 테스트를 다시 실행(재시도)합니다.
run retry --retry session_number`
테스트 실패가 재시도에서 일관되면 나머지 실패한 테스트를 디버깅하는 데 집중합니다. 테스트 결과 문제 해결에 관한 자세한 내용은 테스트 실패 분류와 CTS 테스트 문제 해결을 참고하세요.
멀티스크린 기기용 CTS 실행
기기에서 Android 11 또는 12를 실행하고 기기의 화면이 여러 개라면 cts-foldable
테스트 계획을 별도로 실행해야 합니다.
run cts-foldable
대체 화면 모드의 통과하거나 실패한 테스트 사례는 display_mode
의 값과 함께 추가됩니다. 예를 들면 testcase1[display_mode=0]
과 같습니다.
멀티 디바이스 테스트 실행
cts-multidevice
테스트 계획을 실행하려면 다음 명령어를 실행합니다.
run cts-multidevice
개별 테스트 계획 실행
한 번에 모든 테스트 계획을 실행하는 대신 개별 테스트 계획을 실행할 수 있습니다.
개별 테스트 계획을 실행하려면 다음 단계를 따르세요.
실행하려는 테스트 계획의 이름을 식별하려면 list modules
명령어를 실행합니다.
다음과 같이 테스트 계획을 실행합니다.
run cts --plan test_module_or_plan_name
테스트 실행 시간 개선
테스트 실행 시간을 개선하기 위해 여러 기기에서 테스트를 샤딩할 수 있습니다. 샤딩하려면 호스트에 2개 이상의 기기를 연결해야 하지만, 효율성을 위해 6개 이상의 기기를 연결하는 것이 좋습니다.
Android 11 이상에서 테스트를 샤딩하려면 다음을 실행하세요.
run cts --shard-count number_of_shards
또한 검증을 위해 테스트를 실행하기 전에 CTS run cts-dev
명령어를 사용하여 테스트 실행 시간을 개선할 수 있습니다. 이 명령어는 전제 조건, 기기 정보 수집, 모든 시스템 상태 검사기를 건너뜁니다.
또한 단일 ABI에서만 테스트를 실행합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-05-09(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-05-09(UTC)"],[],[],null,["# Run automated tests (Android 11 or higher)\n\nThere are two options for running CTS automated tests:\n\n- *Trade Federation* is an app and test framework that lets you\n run tests from the command line. Fundamentally, the framework\n lets you annotate tests using the `@Test` annotation and the app finds and runs\n those tests.\n\n- *OmniLab Android Test Station* is an app that lets you run tests\n in a GUI.\n\nThis page explains how to run automated tests using Trade Federation. For\ninstructions on running tests using OmniLab Android Test Harness, see\n[OmniLab Android Test Station](/docs/core/tests/development/android-test-station/ats-user-guide).\n\nRun all automated CTS tests\n---------------------------\n\nTrade Federation contains the *CTS console*, a command-line interface for\nrunning tests. To run the entire automated CTS test suite:\n\n1. Ensure you have followed the instructions in [Set up CTS automated testing](/docs/compatibility/cts/setup).\n2. On your test workstation, launch the CTS console by running the `cts-tradefed` script from the folder where the CTS package has been unzipped:\n\n ./android-cts/tools/cts-tradefed\n\n The CTS console displays a cursor for you to type CTS commands\n (`cts-tradefed \u003e`).\n3. The `cts` test plan contains all of the automated CTS tests. Execute the\n following command to run the `cts` test plan:\n\n run cts\n\n The automated CTS tests execute. Note the following:\n - Android 13 and higher support multidevice testing. These tests run\n automatically only when sharding is used. For further information on sharding,\n see [Improve test execution time](#improve). If you want to run these tests\n manually, see [Run multidevice tests](#multi-device-testing).\n\n - Whenever running CTS, press **ctrl+c** to stop the existing CTS console\n and then rerun the CTS console.\n\n - You can't run multiple CTS versions on single host because each opens\n with an existing open location code (OLC) server.\n\n4. View test results. For more information, see [Interpret CTS results](/docs/compatibility/cts/interpret).\n\n5. If this is your first test run, there might be tests that fail due to issues beyond your control. For example, a network connection might be slow or a GPS signal might be weak. Rerun (retry) the tests until all test modules are completed and the test failure numbers are the same between the last two retry sessions:\n\n run retry --retry \u003cvar translate=\"no\"\u003esession_number\u003c/var\u003e`\n\n | **Note:** For implementation details for CTS retry, see [Use suite retry](/docs/core/tests/tradefed/testing/through-suite/suite-retry).\n | **Note:** For instructions on how to run a retry session on Android 10 or lower, see [Run CTS automated tests (AOSP 10 or lower)](/docs/compatibility/cts/run-older).\n6. After tests failures are consistent across retries, focus on debugging\n the remaining failed tests. For information on troubleshooting test\n results, see\n [Triage test failures](/docs/compatibility/cts/interpret#triaging-test-failures)\n and\n [Troubleshoot CTS tests](/docs/compatibility/cts/troubleshooting).\n\n| **Note:** For a list of all CTS console commands, see [CTS v2 command console](/compatibility/cts/command-console-v2).\n\nRun CTS for multiscreen devices\n-------------------------------\n\nIf your device is running Android 11 or 12, and your device has multiple\nscreens, you must run the `cts-foldable` test plan separately: \n\n run cts-foldable\n\nPassed or failed test cases for alternate screen mode are appended with the\nvalue from `display_mode`, for example, `testcase1[display_mode=0]`.\n| **Note:** For instructions on how to run the `cts-foldable` test plan for Android 10 or lower, see [Run CTS automated tests (Android 10 or lower)](/docs/compatibility/cts/run-older).\n\nRun multidevice tests (Android 15 or lower)\n-------------------------------------------\n\nExecute the following command to run the `cts-multidevice` test plan: \n\n run cts-multidevice\n\nRun individual test plans\n-------------------------\n\nInstead of running all test plans at once, you can run individual test plans.\nThis option is useful to save time and to focus on a specific set of tests.\nTo run an individual test plan:\n\n1. Identify the name of the test plan you want to run by executing the `list modules` command.\n\n | **Note:** For instructions on how to identify the module on Android 10 or lower, see [Run CTS automated tests (Android 10 or lower)](/docs/compatibility/cts/run-older).\n2. Run the test plan:\n\n run cts --plan \u003cvar translate=\"no\"\u003etest_module_or_plan_name\u003c/var\u003e\n\nImprove test execution time\n---------------------------\n\nIf you want to improve test execution time, you can shard tests across multiple\ndevices. Sharding requires the host to connect at least two devices, but six or\nmore devices are recommended for efficiency.\n\nTo shard tests on Android 11 or higher, run: \n\n run cts --shard-count \u003cvar translate=\"no\"\u003enumber_of_shards\u003c/var\u003e\n\nAdditionally, before running your tests for validation you can improve test\nexecution time by using the CTS `run cts-dev` command. This command skips\npreconditions, device-information collection, and all system status checkers.\nIt also runs the tests on only a single ABI."]]