تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يمكنك استخدام Firebase Test Lab عند تطوير تطبيقك باستخدام أي نظام دمج متواصل (CI). تتيح لك أنظمة التكامل المستمر إنشاء تطبيقك واختباره تلقائيًا في كل مرة تُدخل فيها تحديثات على الرمز المصدر لتطبيقك.
استخدام Firebase Test Lab مع Jenkins CI
يوضّح هذا القسم كيفية استخدام Test Lab مع
Jenkins CI.
المتطلبات
قبل أن تتمكّن من استخدام Firebase Test Lab مع Jenkins، عليك إكمال الخطوات التالية:
إنشاء حساب خدمة ومنحه إذن الوصول لا تخضع حسابات الخدمة لعمليات التحقّق من المحتوى غير المرغوب فيه أو لطلبات إدخال رمز التحقّق، ما قد يؤدي إلى حظر عمليات إنشاء التكامل المتواصل. أنشئ حساب خدمة لديه دور محرِّر في
Google Cloud console
ثم فعِّله
(راجِع مستندات gcloud auth activate-service-account
لمعرفة كيفية إجراء ذلك).
فعِّل واجهات برمجة التطبيقات المطلوبة. بعد تسجيل الدخول باستخدام حساب الخدمة، عليك الانتقال إلى صفحة "مكتبة واجهة برمجة التطبيقات" في Google Developers Console، ثم تفعيل Google Cloud Testing API وCloud Tool Results API. لتفعيل واجهات برمجة التطبيقات هذه، اكتب أسماءها في مربّع البحث في أعلى وحدة التحكّم، ثم انقر على تفعيل واجهة برمجة التطبيقات في صفحة النظرة العامة الخاصة بواجهة برمجة التطبيقات هذه.
تثبيت Jenkins وإعداده
يمكنك تثبيت Jenkins CI وإعداده على نظام التشغيل Linux أو Windows. تتضمّن بعض تفاصيل هذا الدليل معلومات خاصة بتثبيت Jenkins CI وتشغيله على نظام التشغيل Linux، بما في ذلك استخدام الشرطات المائلة (/) في مسارات الملفات.
لتنزيل Jenkins وتثبيته على جهاز كمبيوتر يعمل بنظام التشغيل Linux أو Windows، اتّبِع التعليمات الواردة في مقالة تثبيت Jenkins. بعد تثبيت Jenkins، اتّبِع التعليمات الواردة في مقالة بدء استخدام Jenkins والوصول إليه لإكمال عملية الإعداد والوصول إلى لوحة بيانات Jenkins.
ضبط إعدادات الأمان العامة
لا يتم ضبط مصادقة المستخدم والتحكّم في الوصول في Jenkins عند تثبيته لأول مرة. قبل استخدام Jenkins مع Firebase Test Lab، عليك ضبط إعدادات الأمان العام لفرض التحكّم في الوصول والمصادقة على المستخدمين.
انتقِل إلى لوحة بيانات Jenkins على الخادم. لإجراء ذلك، انتقِل إلى
http://<servername>:8080، حيث يمثّل <servername> اسم
الكمبيوتر الذي ثبّت عليه Jenkins.
في لوحة بيانات Jenkins، انقر على Manage Jenkins (إدارة Jenkins)، ثم انقر على Configure Global Security (ضبط إعدادات الأمان العام).
في صفحة إعداد الأمان العام، انقر على تفعيل الأمان، ثم انقر على حفظ.
بعد ذلك، أنشئ مشروعًا لتنفيذ اختبارات الدمج المتواصل لتطبيقك باستخدام Firebase Test Lab.
لإنشاء مشروع Jenkins، اتّبِع الخطوات التالية:
انتقِل إلى لوحة بيانات Jenkins على الخادم. لإجراء ذلك، انتقِل إلى
http://<servername>:8080، حيث يمثّل <servername> اسم
الكمبيوتر الذي ثبّت عليه Jenkins.
في لوحة بيانات Jenkins، انقر على عنصر جديد.
اكتب اسمًا لمشروعك في حقل اسم العنصر:
اختَر مشروع بدون قيود لإنشاء مشروع يستخدم إعدادًا واحدًا للإنشاء.
اختَر إنشاء مشروع بإعدادات متعددة لإنشاء مشروع يعمل على إعدادات مختلفة متعددة. إذا كنت تخطّط لإنشاء تطبيقك باستخدام مجموعة متنوعة من إعدادات الإنشاء (لغات متعددة، ومستويات متعددة لواجهة برمجة التطبيقات Android، وما إلى ذلك)، فإنّ المشروع المتعدد الإعدادات هو الخيار الأفضل.
انقر على حفظ.
بعد إنشاء مشروعك، يعرض متصفّح الويب الصفحة الرئيسية لمشروعك.
إضافة خطوات إنشاء Gradle والتحكّم في المراجعات
يوضّح هذا القسم كيفية دمج Jenkins مع أنظمة التحكّم في المراجعات، مثل GitHub، وكيفية إضافة خطوات إنشاء Gradle لإنشاء حِزم APK من الرمز المصدر.
التكامل مع GitHub وأنظمة أخرى للتحكّم في المراجعات
إذا كنت تستخدم GitHub أو نظامًا آخر للتحكّم في المراجعات لإدارة الرمز المصدر لتطبيقك، يمكنك ضبط Jenkins لتنفيذ عمليات إنشاء مبرمَجة وإجراء اختبارات في كل مرة يتم فيها تسجيل التعديلات على تطبيقك. يمكنك أيضًا ضبط Jenkins لتنفيذ عمليات الإنشاء بشكل دوري.
إذا كنت تستخدم نظامًا للتحكّم في المراجعات من أجل إدارة الرمز المصدر لتطبيقك، عليك تضمين خطوة إنشاء Gradle لإنشاء ملفات ثنائية جديدة لحِزم APK في كل مرة ينزّل فيها Jenkins الرمز المصدر من نظام التحكّم في المراجعات.
أضِف خطوة إنشاء لتنفيذ الأوامر التالية في الدليل الرئيسي لتطبيقك:
أضِف خطوة إنشاء لاستخدام حِزم APK التي أنشأها Gradle عند إجراء الاختبار باستخدام Test Lab. يمكنك استخدام هذا المسار كـ
<local_server_path> في مثال نص shell البرمجي الموضّح أدناه،
حيث <AppFolder> هو مجلد مشروع "استوديو Android" لتطبيقك:
<AppFolder>/app/build/outputs/apk
إضافة خطوات إنشاء Test Lab إلى Jenkins
أنت الآن جاهز لإضافة خطوة إنشاء إلى Jenkins لتشغيل Test Lab باستخدام سطر أوامر gcloud.
لإضافة خطوة إنشاء gcloud، اتّبِع الخطوات التالية:
من الصفحة الرئيسية لمشروعك، انقر على ضبط.
في صفحة إعدادات المشروع، انتقِل للأسفل إلى قسم إنشاء،
ثم اختَر تنفيذ shell من قائمة إضافة خطوة إنشاء.
في نافذة Jenkins Execute shell command، أدخِل ما يلي، مع استبدال <local_server_path> بمسار التطبيق النموذجي على الخادم، و<app_apk> بملف APK الخاص بتطبيقك، و<app_test_apk> بملف APK الخاص باختبار تطبيقك:
gcloud firebase test android run --app <local_server_path>/<app_apk>.apk
--test <local_server_path>/<app_test_apk>.apk
تحليل نتائج الاختبار
بعد أن يكمل Test Lab اختبار تطبيقك، يمكنك مراجعة نتائج الاختبار في وحدة تحكّم Firebase أو في حزمة Google Cloud Storage ضمن مشروعك. يمكنك أيضًا إضافة الأمر
gsutil إلى
أمر shell الموضّح أعلاه لنسخ بيانات نتائج الاختبار إلى جهاز الكمبيوتر المحلي.
لمزيد من المعلومات، اطّلِع على مقالة تحليل نتائج Firebase Test Lab.
التكامل المستمر مع أنظمة التكامل المستمر الأخرى
للتعرّف على كيفية استخدام Firebase Test Lab مع أنظمة CI الأخرى، يمكنك الاطّلاع على مستنداتها:
تاريخ التعديل الأخير: 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\nYou can use Firebase Test Lab when developing your app using any continuous\nintegration (CI) system. Continuous integration systems let you automatically\nbuild and test your app each time you check in updates to your app source code.\n\nUsing Firebase Test Lab with Jenkins CI\n\nThis section describes how to use Test Lab with\n[Jenkins CI](http://jenkins-ci.org/).\n\nRequirements\n\nBefore you can use Firebase Test Lab with Jenkins, you need to complete the\nfollowing steps:\n\n1. **Set up gcloud.** Follow the instructions from\n [Using Firebase Test Lab from the gcloud Command Line](/docs/test-lab/android/command-line)\n to create a Firebase project and configure your local Google Cloud SDK\n environment.\n\n2. **Create and authorize a service account.** Service accounts aren't subject\n to spam checks or captcha prompts, which could otherwise block your CI\n builds. Create a service account with an **Editor** role in the\n [Google Cloud console](https://console.cloud.google.com/iam-admin/serviceaccounts/)\n and then activate it\n (see the [gcloud auth activate-service-account documentation](https://cloud.google.com/sdk/gcloud/reference/auth/activate-service-account)\n to learn how).\n\n3. **Enable required APIs.** After logging in using the service account: In the\n [Google Developers Console API Library page](https://console.developers.google.com/apis/library),\n enable the **Google Cloud Testing API** and **Cloud Tool Results API** . To\n enable these APIs, type these API names into the search box at the top of the\n console, and then click **Enable API** on the overview page for that API.\n\nInstall and set up Jenkins\n\nYou can install and set up Jenkins CI on Linux or Windows. Certain details of\nthis guide are specific to installing and running Jenkins CI on Linux, including\nthe use of slashes (`/`) in file paths.\n\nTo download and install Jenkins on a computer running Linux or Windows, follow\nthe instructions on [Installing\nJenkins](https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins). After\ninstalling Jenkins, follow the instructions on\n[Starting and Accessing Jenkins](https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins)\nto complete setup and access the Jenkins dashboard.\n\nConfigure global security settings\n\nJenkins does not have user authentication and access control configured when it\nis first installed. Before using Jenkins with Firebase Test Lab, configure\nglobal security settings to enforce access control and authenticate\nusers.\n\nTo configure global security settings\n\n1. Navigate to the Jenkins dashboard on your server. To do this, browse to **http://\\\u003cservername\\\u003e:8080** , where **\\\u003cservername\\\u003e** is the name of the computer where you have installed Jenkins.\n2. On the Jenkins dashboard, click **Manage Jenkins** , and then click **Configure Global Security**.\n3. On the **Configure Global Security** page, click **Enable security** , and then click **Save**.\n\nFor more information about configuring security settings for Jenkins, see\n[Quick and Simple Security](https://wiki.jenkins-ci.org/display/JENKINS/Quick+and+Simple+Security),\n[Standard Security Setup](https://wiki.jenkins-ci.org/display/JENKINS/Standard+Security+Setup),\nand\n[Securing Jenkins](https://wiki.jenkins-ci.org/display/JENKINS/Securing+Jenkins).\n\nCreate a Jenkins project\n\nNext, create a project for running continuous integration testing of your app\nwith Firebase Test Lab.\n\nTo create a Jenkins project\n\n1. Navigate to the Jenkins dashboard on your server. To do this, browse to **http://\\\u003cservername\\\u003e:8080** , where **\\\u003cservername\\\u003e** is the name of the computer where you have installed Jenkins.\n2. On the Jenkins dashboard, click **New Item**.\n3. Type a name for your project in the **Item name** field:\n - Choose **Freestyle project** to create a project that uses a single build configuration.\n - Choose **Build multi-configuration project** to create a project that runs on multiple different build configurations. If you plan to build your app with a variety of build configurations (multiple locales, multiple Android API levels, etc.), then a multi-configuration project is the best choice.\n4. Click **Save**.\n\nAfter your project is created, your web browser displays the main page for your\nproject.\n\nAdd revision control and Gradle build steps\n\nThis section describes how to integrate Jenkins with revision control systems\nsuch as GitHub, and how to add Gradle build steps to build APK packages\nfrom source code.\n\nIntegrating with GitHub and other revision control systems\n\nIf you use GitHub or another revision control system to manage the source code\nfor your app, you can configure Jenkins to run automated builds and run tests\neach time updates to your app are checked in. You can also configure\nJenkins to run builds periodically.\n\nTo learn about configuring builds in Jenkins, see\n[Configuring automatic builds](https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-Configuringautomaticbuilds).\n\nAdding Gradle build steps to rebuild APK packages\n\nIf you use a revision control system to manage source code for your app, you\nneed to include a Gradle build step to create new APK binaries each time Jenkins\ndownloads source code from your revision control system.\n\n1. Add a build step to run the following commands in the main directory for your\n application:\n\n ```\n ./gradlew :app:assembleDebug\n ./gradlew :app:assembleDebugAndroidTest\n ```\n\n \u003cbr /\u003e\n\n2. Add a build step to use the APK package(s) created by Gradle when testing\n with Test Lab. You can use this path as the\n **\\\u003clocal_server_path\\\u003e** in the shell script example provided below,\n where **\\\u003cAppFolder\\\u003e** is the Android Studio project folder for your\n app:\n\n ```\n \u003cAppFolder\u003e/app/build/outputs/apk\n ```\n\n \u003cbr /\u003e\n\nAdd Test Lab build steps to Jenkins\n\nNow you are ready to add a build step to Jenkins to run Test Lab using\nthe gcloud command line.\n\nTo add a gcloud build step\n\n1. From the main page for your project, click **Configure**.\n2. On the **project configuration** page, scroll down to the **Build** section,\n and then choose **Execute shell** from the **Add build step** menu.\n\n3. In the **Jenkins Execute shell command** window, enter the following,\n substituting **\\\u003clocal_server_path\\\u003e** for the path to the sample app on\n the server, **\\\u003capp_apk\\\u003e** for your app's APK, and\n **\\\u003capp_test_apk\\\u003e** for your app's test APK:\n\n ```\n gcloud firebase test android run --app \u003clocal_server_path\u003e/\u003capp_apk\u003e.apk\n --test \u003clocal_server_path\u003e/\u003capp_test_apk\u003e.apk\n ```\n\n \u003cbr /\u003e\n\nAnalyze test results\n\nAfter Test Lab completes testing of your app, you can review test\nresults in the Firebase console or in a\n[Google Cloud Storage](//cloud.google.com/storage/) bucket in\nyour project. You can also add a\n[`gsutil`](//cloud.google.com/storage/docs/gsutil) command to the\nshell command shown above to copy the test results data to your local computer.\nTo learn more, see\n[Analyzing Firebase Test Lab Results](/docs/test-lab/analyzing-results).\n\nContinuous integration with other CI systems\n\nTo learn how to use Firebase Test Lab with other CI systems, check out\ntheir docs:\n\n- [Bitrise](//devcenter.bitrise.io/testing/device-testing-for-android/)\n- [Circle CI](//circleci.com/docs/2.0/language-android/#testing-with-firebase-test-lab)\n\n| **Note:** If you create documentation explaining how to use Firebase Test Lab with another CI system, [contact us](mailto:cloud-test-lab-integration@google.com) so that we can review it for inclusion in this section."]]