تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توفّر Firebase Test Lab بنية تحتية مستندة إلى السحابة الإلكترونية لاختبار تطبيقات Android، وتتضمّن ميزة التكامل الكامل مع "استوديو Android" لتنفيذ الاختبارات المبرمَجة ومراجعة نتائج الاختبار.
يوضّح هذا الدليل كيفية تعديل الاختبارات المبرمَجة في "استوديو Android" حتى تتمكّن من دمجها وتشغيلها باستخدام Test Lab. للحصول على تعليمات حول استخدام
Test Lab من واجهة مستخدم "استوديو Android" لإنشاء مصفوفة اختبار وتشغيل اختبار مزوَّد بأدوات وعرض نتائج الاختبار، يُرجى الاطّلاع على تشغيل الاختبارات باستخدام Firebase Test Lab.
أخذ لقطات شاشة
توفّر Test Lab إمكانية التقاط لقطات شاشة عند إجراء اختبارات مزوَّدة بأدوات. للتعرّف على كيفية التقاط لقطات شاشة، راجِع مقالة
إضافة مكتبة لقطات الشاشة إلى مشروعك.
إنشاء اختبارات باستخدام "مسجّل اختبار Espresso"
تتيح لك أداة "مسجّل اختبارات Espresso" إنشاء اختبارات لواجهة المستخدم لتطبيقك بدون كتابة أي رمز اختبار. يمكنك تسجيل تفاعلاتك مع جهاز وإضافة تأكيدات للتحقّق من عناصر واجهة المستخدم في لقطات معيّنة من تطبيقك. بعد ذلك، تأخذ أداة "تسجيل الاختبار" في Espresso التسجيل المحفوظ وتنشئ تلقائيًا اختبار واجهة مستخدم مطابقًا في Espresso يمكنك تنفيذه لاختبار تطبيقك في Test Lab.
توفّر Test Lab متغيّر نظام يمكنك إضافته إلى اختبارات قياس حالة التطبيق حتى تتمكّن من جعلها تتصرف بشكل مختلف عند تشغيلها في Test Lab مقارنةً بتشغيلها على جهاز الاختبار أو المحاكي الخاص بك.
يقرأ مثال الرمز البرمجي التالي إحدى خصائص النظام، firebase.test.lab، ويضبط السلسلة testLabSetting على true إذا كان الاختبار قيد التشغيل في Test Lab.
ثم تستخدم قيمة هذه السلسلة لتحديد ما إذا كان سيتم تنفيذ عبارات إضافية أم لا:
Kotlin
valtestLabSetting=Settings.System.getString(contentResolver,"firebase.test.lab")if("true"==testLabSetting){// Do something when running in Test Lab// ...}
StringtestLabSetting=Settings.System.getString(getContentResolver(),"firebase.test.lab");if("true".equals(testLabSetting)){// Do something when running in Test Lab// ...}
استخدام الأجهزة المُدارة من Gradle من خلال المكوّن الإضافي Firebase Test Lab
تتيح لك "الأجهزة المُدارة من Gradle" من خلال المكوّن الإضافي Firebase Test Lab
تشغيل اختبارات آلية شاملة على نطاق واسع على Test Lab
الأجهزة، استنادًا إلى الإعدادات في ملفات Gradle الخاصة بمشروعك.
توفّر الأجهزة المُدارة من Gradle أيضًا ميزة التقسيم الذكي التي تتيح لك توزيع الاختبارات على الأجزاء على النحو الأمثل استنادًا إلى سجلّ الاختبارات السابق. باستخدام التقسيم الذكي، يتم تشغيل الأجزاء لمدة زمنية متساوية تقريبًا، ويتم عرض نتائج الاختبار بأسرع وقت ممكن. تتيح لك ميزة "التقسيم الذكي" تشغيل مجموعات اختبار كبيرة بالتوازي، ما يجعل هذه الميزة مناسبة تمامًا لعمليات التكامل المستمر والتسليم المستمر.
تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nFirebase Test Lab provides cloud-based infrastructure for testing Android\napps, and features full integration with Android Studio for running\ninstrumented tests and reviewing test results.\n\nThis guide describes how to modify instrumented tests in Android Studio so you\ncan integrate and run them with Test Lab. For instructions on using\nTest Lab from the Android Studio UI to create a test matrix, run an\ninstrumented test, and view the test results, see\n[Run your tests with Firebase Test Lab](https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html#run-ctl).\n\nCapture screenshots\n\nTest Lab provides support for capturing screenshots when running\ninstrumented tests. To learn how to capture screenshots, see\n[Add the screenshot library to your project](/docs/test-lab/android/instrumentation-test#add-screenshot-library).\n\nCreate tests using Espresso Test Recorder\n\nThe Espresso Test Recorder tool lets you create UI tests for your app without\nwriting any test code. You can record your interactions with a device and add\nassertions to verify UI elements in particular snapshots of your app. Espresso\nTest Recorder then takes the saved recording and automatically generates a\ncorresponding Espresso UI test that you can run to test your app in Test Lab.\n\nTo learn more, see\n[Create UI Tests with Espresso Test Recorder](//developer.android.com/studio/test/espresso-test-recorder.html).\n\nModify instrumented test behavior for Test Lab\n\nTest Lab provides a system variable that you can add to your instrumented\ntests so that you can cause them to behave differently when you run them in\nTest Lab than when you run them on your own test device or emulator.\n\nThe following code example reads a system property, `firebase.test.lab`, and\nsets a string, `testLabSetting` to `true` if the test is running in Test Lab.\nThen, it uses the value of this string to control whether additional statements\nare executed: \n\nKotlin \n\n```kotlin\nval testLabSetting = Settings.System.getString(contentResolver, \"firebase.test.lab\")\nif (\"true\" == testLabSetting) {\n // Do something when running in Test Lab\n // ...\n}https://github.com/firebase/snippets-android/blob/b694d4dbd411d31be39655f47691c3e9f3529b03/test-lab/app/src/main/java/com/google/firebase/example/testlab/kotlin/MainActivity.kt#L17-L21\n```\n\nJava \n\n```java\nString testLabSetting = Settings.System.getString(getContentResolver(), \"firebase.test.lab\");\nif (\"true\".equals(testLabSetting)) {\n // Do something when running in Test Lab\n // ...\n}https://github.com/firebase/snippets-android/blob/b694d4dbd411d31be39655f47691c3e9f3529b03/test-lab/app/src/main/java/com/google/firebase/example/testlab/MainActivity.java#L26-L30\n```\n\nUse Gradle Managed Devices via the Firebase Test Lab plugin\n\nGradle Managed Devices via the Firebase Test Lab\nplugin lets you run automated instrumented tests at scale on Test Lab\ndevices, based on the configurations in your project's Gradle files.\n\nGradle Managed Devices also offer smart sharding, which lets you distribute\ntests optimally across shards based on your previous test history. With smart\nsharding, shards run for approximately the same length of time and return test\nresults as quickly as possible. Smart sharding lets you run large test suites in\nparallel, making this feature well suited for CI/CD flows.\n\nTo enable smart sharding using the [Gradle Managed Devices Test Lab plugin](https://developer.android.com/studio/test/gradle-managed-devices#gmd-ftl),\nfollow the instructions in [Optimize test runs with smart\nsharding](https://developer.android.com/studio/test/gradle-managed-devices#smart-sharding)\n."]]