اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
إجراء اختبارات مبرمَجة (الإصدار 11 من نظام التشغيل Android أو الإصدارات الأحدث)
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
هناك خياران لإجراء الاختبارات المبرمَجة في CTS:
Trade Federation هو إطار عمل للتطبيقات والاختبارات يتيح لك
إجراء الاختبارات من سطر الأوامر. بشكل أساسي، يتيح لك إطار العملannotate الاختبار باستخدام التعليق التوضيحي @Test
، ويبحث التطبيق عن هذه الاختبارات وينفّذها.
OmniLab Android Test Station هو تطبيق يتيح لك إجراء اختبارات
في واجهة مستخدم رسومية.
توضّح هذه الصفحة كيفية إجراء اختبارات مبرمَجة باستخدام Trade Federation. للحصول على
تعليمات حول إجراء الاختبارات باستخدام حزمة اختبارات Android من OmniLab، يُرجى الاطّلاع على
محطة اختبارات Android من OmniLab.
تشغيل جميع اختبارات 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]
.
إجراء اختبارات على أجهزة متعددة (Android 15 أو إصدار أقدم)
نفِّذ الأمر التالي لتشغيل خطة اختبار cts-multidevice
:
run cts-multidevice
تنفيذ خطط اختبار فردية
بدلاً من تنفيذ جميع خطط الاختبار في آنٍ واحد، يمكنك تنفيذ خطط اختبار فردية.
هذا الخيار مفيد لتوفير الوقت والتركيز على مجموعة معيّنة من الاختبارات.
لتنفيذ خطة اختبار فردية:
حدِّد اسم خطة الاختبار التي تريد تنفيذها من خلال تنفيذ الأمر list modules
.
لتنفيذ خطة الاختبار:
run cts --plan test_module_or_plan_name
تحسين وقت تنفيذ الاختبار
إذا كنت تريد تحسين وقت تنفيذ الاختبار، يمكنك تقسيم الاختبارات على عدة
أجهزة. تتطلّب ميزة "تقسيم البيانات" أن يربط المضيف جهازَين على الأقل، ولكن يُنصح باستخدام ستة أجهزة أو
أكثر لتحقيق الكفاءة.
لتقسيم الاختبارات على Android 11 أو إصدار أحدث، شغِّل:
run cts --shard-count number_of_shards
بالإضافة إلى ذلك، قبل تنفيذ اختبارات التحقّق، يمكنك تحسين وقت تنفيذ الاختبار باستخدام الأمر CTS run cts-dev
. يتخطّى هذا الأمر
الشروط المسبقة وجمع معلومات الجهاز وجميع أدوات التحقّق من حالة النظام.
ويُجري أيضًا الاختبارات على ملف ABI واحد فقط.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-30 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-07-30 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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."]]