تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضّح هذا المستند كيفية استخدام برامج Robo النصية، وهي اختبارات تعمل على أتمتة مهام ضمان الجودة اليدوية لتطبيقات الأجهزة الجوّالة، وتتيح استراتيجيات التكامل المستمر (CI) والاختبار قبل الإطلاق. على سبيل المثال، يمكنك استخدام نصوص Robo البرمجية
لاختبار تجربة مستخدم شائعة أو تقديم إدخال محدّد لواجهة المستخدم،
مثل اسم المستخدم وكلمة المرور. نصوص Robo البرمجية هي إحدى ميزات
اختبار Robo.
باستخدام نصوص Robo البرمجية، يمكنك تسجيل خطواتك أثناء تنفيذ سير عمل في تطبيقك، ثم تحميل هذا التسجيل إلى وحدة تحكّم Firebase لتشغيله في اختبارات Robo. عند إجراء اختبار Robo مع إرفاق نص برمجي، ينفِّذ Robo أولاً الإجراءات التي تشتمل على نص برمجي، ثم يستكشف التطبيق كالمعتاد.
تستخدم نصوص Robo البرمجية اختبار Robo كمحرّك للاختبار. في أبسط أشكاله، يتألف نص Robo البرمجي من سلسلة من إجراءات واجهة المستخدم، مثل إدخال النص "اسم المستخدم" ثم النقر على زر "حسنًا". يمكن أن تتضمّن نصوص Robo البرمجية أيضًا إجراءات مثل انتظار ظهور عنصر، والنقر على نقطة محدّدة داخل عنصر، وتنفيذ أوامر shell الخاصة بأداة Android Debug Bridge (adb).
تتفوّق نصوص Robo البرمجية على أُطر الاختبار التقليدية في المزايا التالية:
الإمكانية
الوصف
قوي للغاية
يمكن أن تتحمّل نصوص Robo البرمجية اختلافات كبيرة في البنية والسلوك بين إصدارات التطبيق، كما يمكنها التعامل مع عدم استقرار التطبيق.
أسئلة مفتوحة
بعد انتهاء نص Robo البرمجي، يمكن أن يتولّى اختبار Robo الأساسي مهمة مواصلة اختبار التطبيق. ويتيح أسلوب الاختبار المتواصل هذا العديد من حالات الاستخدام الرئيسية. على سبيل المثال، يمكنك استخدام نص Robo برمجي لنقل تطبيق إلى حالة معيّنة من خلال تنفيذ عملية تسجيل دخول مخصّصة.
قابل للتسجيل
لست بحاجة إلى كتابة نصوص Robo البرمجية يدويًا. ويمكن تسجيلها باستخدام مسجّل نصوص Robo البرمجية في "استوديو Android". لا يتطلّب إنشاء نصوص Robo البرمجية أو تعديلها عادةً أي معرفة بتطوير تطبيقات الأجهزة الجوّالة.
المرونة
يمكن أن تتفاعل نصوص Robo البرمجية مع عناصر واجهة المستخدم غير الأصلية الشائعة في الألعاب.
يتم تشغيل نصوص Robo البرمجية بشكل مشروط أثناء اختبار Robo، ما يتيح للمستخدمين تحسين سلوك Robo، وعادةً ما يكون ذلك بهدف تحقيق تغطية أكبر أو استهداف وظائف محدّدة. على عكس أُطر الاختبار التقليدية، تتيح نصوص Robo البرمجية ما يلي:
شروط مختلفة لتفعيل الإجراء، مثل تفعيل (أو عدم تفعيل) اسم حزمة تطبيق معيّن أو عرض (أو عدم عرض) عنصر معيّن على الشاشة
عناصر التحكّم في التنفيذ، مثل الحدّ الأقصى لعدد عمليات التنفيذ والأولوية ومرحلة الزحف ذات الصلة
أنواع الإجراءات غير التقليدية (الشَرطية، وتجاهُل العناصر، وإغلاق الشاشة)
ننصحك باستخدام نصوص Robo البرمجية كلما أمكن ذلك لأنّه يمكن صيانتها بسهولة. على سبيل المثال، يمكنك استخدام نص برمجي خاص ببرنامج Robo لتنفيذ ما يلي:
التنقّل في مسارات العمل المهمة للوصول إلى الوظيفة الأساسية للتطبيق
على سبيل المثال، يمكنك تسجيل الدخول وإعداد حالة التطبيق بعد التشغيل الأول وتسجيل مستخدم جديد.
يمكنك تركيز Robo على جزء معيّن من التطبيق لتحقيق أقصى استفادة من وقت اختبار Robo. يرشد نص Robo البرمجي اختبار Robo للوصول إلى الجزء ذي الصلة من التطبيق، حيث يستأنف اختبار Robo عملية الزحف المبرمَجة بالكامل.
إحضار تطبيق إلى حالة أو شاشة معيّنة لإجراء تحليل، مثلاً، لتحليل رسالة داخل التطبيق أو سياسة الخصوصية أو مستوى معيّن من لعبة
إجراء اختبار شامل للأدوات، مع أو بدون استئناف اختبار Robo لعملية الزحف المبرمَجة بالكامل بعد اكتمال نص Robo البرمجي
استخدِم ميزات أكثر تقدّمًا في نصوص Robo البرمجية لتنفيذ ما يلي:
تنفيذ إجراءات قبل أن يبدأ Robo في الزحف إلى التطبيق قيد الاختبار أو بعد انتهاء عملية الزحف، مثل محو بيانات التطبيق قيد الاختبار قبل عملية الزحف أو تغيير إعدادات الجهاز
تغيير جوانب سلوك Robo أثناء الزحف، لا سيما:
اجعل Robo يتجاهل بعض التطبيقات المصغّرة لواجهة المستخدم أو شاشات التطبيق.
قدِّم إجراءً مخصّصًا لتنفيذه بواسطة Robo عند الرجوع من شاشة معيّنة.
اجعل Robo ينفّذ إجراءات محدّدة كلما تم رصد شاشة تطبيق معيّنة أثناء الزحف.
تخصيص طريقة الزحف التي تتّبعها أداة Robo بالكامل على سبيل المثال، استخدِم مجموعة من الإجراءات الشرطية وغير الشرطية لإبقاء التطبيق قيد الاختبار في الخلفية طوال عملية الزحف، مع تنفيذ عمليات معالجة على الجهاز ورفض أي مربّعات حوار منبثقة تظهر أثناء ذلك.
يُرجى العِلم أنّ نصوص Robo البرمجية لا تحلّ محل جميع أنواع الاختبارات. ستظل بحاجة إلى اختبارات الوحدات لرصد أخطاء منطقية على مستوى منخفض في تطبيقك، ولا تتطلّب هذه الاختبارات عادةً بيئة Android أو iOS. ننصحك بإضافة اختبارات أدوات القياس المستهدَفة إلى اختبارات Robo التي يمكن أن تتضمّن تأكيدات محدّدة ومفصّلة بشأن منطق النشاط التجاري، والتي من الأفضل التعبير عنها في الرمز.
تسجيل نص Robo برمجي باستخدام Test Lab في "استوديو Android"
يتيح لك مسجّل نصوص Robo البرمجية في "استوديو Android" تسجيل نصوص Robo البرمجية من خلال التفاعل مباشرةً مع التطبيق على جهازك. اتّبِع التعليمات التالية
لبدء استخدام نصوص Robo البرمجية من خلال أداة Firebase في "استوديو Android":
في لوحة Firebase، انقر على
تسجيل نص Robo البرمجي واستخدامه لتوجيه اختبار Robo.
انقر على تسجيل نص Robo البرمجي. يظهر مربّع الحوار "اختيار هدف النشر".
اختَر الجهاز الذي تريد تسجيل نص Robo فيه.
بعد تسجيل نص Robo البرمجي على الجهاز، احفظ الملف كملف JSON
في الموقع المطلوب.
افتح صفحة Test Lab في وحدة تحكّم Firebase وحمِّل ملف نص JSON وAPK التطبيق.
انقر على زر متابعة. سيُطلب منك اختيار الجهاز ومستوى واجهة برمجة التطبيقات. بعد اكتمال نص الاختبار، ينشئ Test Lab تقرير الاختبار.
(اختياري) لنسخ أو تنزيل logcat لتقرير الاختبار والفيديو، انقر على عرض ملفات المصدر.
تمنع آليات قوة النصوص البرمجية في Robo حدوث أي أعطال مبكرة.
إذا اخترت وضع التنفيذ strict وتعذّر تنفيذ نص برمجي في Robo في أي مرحلة، سيتجاهل Test Lab جميع الخطوات اللاحقة في النص البرمجي ويستأنف عملية الزحف العادية في Robo. في أغلب الأحيان، لا تنجح نصوص Robo البرمجية لأنّ Robo لا يمكنه العثور على عنصر مطلوب على الشاشة. لتجنُّب حدوث أخطاء، تأكَّد من أنّ التنقّل في تطبيقك يتم بشكل متوقّع وأنّ شاشاتك تظهر بترتيب محدّد.
تشغيل نص Robo برمجي في Test Lab
لتشغيل نص Robo البرمجي في Test Lab، اتّبِع التعليمات التالية:
افتح صفحة Test Lab في وحدة تحكّم Firebase.
حمِّل حِزمة APK أو AAB للتطبيق في حقل حِزمة APK أو AAB للتطبيق.
حمِّل ملف نص Robo البرمجي المسجَّل أو الذي تم إنشاؤه يدويًا في حقل نص Robo البرمجي (اختياري).
تاريخ التعديل الأخير: 2025-09-03 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-03 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nThis document describes how to use *Robo scripts* , which are tests that\nautomate manual QA tasks for mobile apps, and enable continuous integration\n(CI) and pre-launch testing strategies. For example, you can use Robo scripts\nto test a common user journey or provide specific user interface (UI) input,\nlike a username and password. Robo scripts are a feature of\n[Robo test](/docs/test-lab/android/robo-ux-test).\n\nWith Robo scripts, you record yourself walking through a workflow in your app,\nthen you upload that recording to the Firebase console to run in Robo\ntests. When you run a Robo test with a script attached, Robo first steps\nthrough your pre-scripted actions and then explores the app as usual.\n\nRobo scripts use [Robo test](/docs/test-lab/android/robo-ux-test)\nas the test engine. In its most basic form, a Robo script consists of a\nsequence of UI actions like *enter text 'username'* and\nthen *tap the OK button* . Robo scripts can also include actions like waiting\nfor an element to appear, tapping at a specific point within an element, and\nexecuting Android Debug Bridge (`adb`) shell commands.\n\nRobo scripts have the following advantages over traditional testing frameworks:\n\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Capability** | **Description** |\n| Highly robust | Robo scripts can tolerate significant structural and behavioral differences between app versions and app flakiness. |\n| Open-ended | After a Robo script completes, the base Robo test can take over and continue testing the app. This continued testing approach enables several key use cases. For example, you can use a Robo script to bring an app into a particular state by performing a custom sign-in flow. |\n| Recordable | You don't need to code Robo scripts manually. They can be recorded using the Robo script recorder in Android Studio. Creating or modifying Robo scripts typically doesn't require any knowledge of mobile development. |\n| Flexible | Robo scripts can interact with non-native UI elements that are common in games. |\n\nRobo scripts are conditionally triggered during a Robo test, which lets users\naugment Robo's behavior - typically to achieve greater coverage or target\nspecific functionality. In contrast to traditional testing frameworks,\nRobo scripts support the following:\n\n- Various triggering conditions, for example, a particular app package name being active (or not) or a specific element being displayed on the screen (or not).\n- Execution controls, for example, a maximum number of executions, priority, relevant crawl stage.\n- Unconventional action types (conditional, element-ignoring, screen-closing).\n\nWe recommend that you use Robo scripts whenever possible because they can be\nmaintained effortlessly. For example, you can use a Robo script to do the\nfollowing:\n\n- Navigate significant workflows to get to the core of an app's functionality. For example, you can perform a sign-in, set up an app's state after the first launch, and register a new user.\n- Focus Robo on a particular part of an app to get the most out of Robo test time. Robo script guides Robo test to reach the relevant part of an app, where Robo test resumes a fully automated crawl.\n- Bring an app into a specific state or screen to perform an analysis, for example, to analyze an in-app message, privacy policy, or specific level of a game.\n- Perform an end-to-end instrumentation test, with or without Robo test resuming a fully automated crawl after the Robo script is complete.\n\nUse more advanced Robo script features to do the following:\n\n- Perform actions before Robo starts crawling the app-under-test or after a crawl is finished, for example, clean the app-under-test data before a crawl, or change device settings.\n- Change aspects of Robo behavior during a crawl, in particular:\n - Make Robo ignore some UI widgets or app screens.\n - Provide a custom action for Robo to perform when backtracking from a particular screen.\n - Make Robo perform specific actions whenever a particular app screen is encountered during a crawl.\n- Completely customize how Robo performs a crawl. For example, use a combination of conditional and non-conditional actions to keep the app-under-test in the background throughout the crawl, while performing device manipulations and dismissing any popup dialogs that appear along the way.\n\nKeep in mind that Robo scripts don't replace all kinds of tests. You still\nneed unit tests to catch low-level logic bugs in your app; these tests\ntypically don't require an Android or iOS environment. We recommend that you\nsupplement Robo script tests with targeted instrumentation tests that can have\nspecific, detailed assertions about business logic, which are best expressed\nin code.\n\nRecord a Robo script using Test Lab in Android Studio\n\nThe Robo script recorder in Android Studio lets you record Robo scripts by\ninteracting directly with the app on your device. Follow these instructions\nto get started with Robo scripting through the Firebase tool in Android Studio:\n\n1. Open [Android Studio](https://developer.android.com/studio)\n and select **Tools -\\\u003e Firebase**.\n\n2. In the Firebase pane, click\n **Record Robo Script and Use it to Guide Robo Test**.\n\n3. Click **Record Robo script**. The Select Deployment Target dialog\n appears.\n\n4. Select the device in which you want to record the Robo script.\n\n5. After you record the Robo script in the device, save the file as a JSON file\n in the desired location.\n\n6. Open the Test Lab page in the Firebase console and upload the JSON\n script file and the application APK.\n\n7. Click the **Continue** button. You are prompted to select the device and\n API level. After the test script completes, Test Lab generates the\n test report.\n\n8. (Optional) To copy or download the logcat of the test report and the video,\n click **View Source Files**.\n\n| **Note:** Robo script recordings don't capture your actions outside the tested app. For example, sign-ins through Facebook, Twitter, and other social apps aren't recorded.\n\nBy default, Robo script robustness mechanisms prevent it from failing early.\nIf you choose the `strict` execution mode and a Robo script fails at any point,\nTest Lab abandons all further steps in the script and resumes a regular\nRobo crawl. Most often, Robo scripts fail because Robo can't find a required\nelement on the screen. To avoid failures, make sure that your app navigation is\npredictable and that your screens are shown in a deterministic order.\n\nRun a Robo script in Test Lab\n\nTo run a Robo script in Test Lab, follow these instructions:\n\n1. Open the Test Lab page in the Firebase console.\n\n2. Upload the app's APK or AAB in the **App APK or AAB field**.\n\n3. Upload your recorded or manually created Robo script file in the\n **Robo script (optional)** field.\n\nProvide a Robo script to a local Robo test run\n\nTo provide a Robo script to a local Robo test run, use the following Robo test\noption:\n\n`--robo-script-file \u003crobo-script-path\u003e`\n\nReplace `\u003crobo-script-path\u003e` with a path to your Robo script file in the local\nfile system. Follow the [instructions for a local Robo test\nrun](https://developer.android.com/training/testing/crawler).\n\nSpecify a Robo script in a gcloud CLI test invocation\n\nTo specify a Robo script in a gcloud CLI test invocation, use the following\ngcloud CLI flag: \n\n --robo-script = \u003crobo-script-path\u003e\n\nReplace `\u003crobo-script-path\u003e` with a path to your Robo script file in the local\nfile system or in Cloud Storage using `gs://` notation. For example: \n\n gcloud firebase test android run --app = \u003cpath_to_app_apk_file\u003e --robo-script = \u003crobo-script-path\u003e\n\nNext steps\n\n- To learn about Robo scripts structure, capabilities, usage, and actions, see the [Robo scripts reference guide](/docs/test-lab/android/robo-scripts-reference).\n- [Run a Robo test](/docs/test-lab/android/robo-ux-test)."]]