הרצת סקריפט של Robo (iOS ואילך)
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במאמר הזה נסביר איך להשתמש בסקריפטים של Robo, שהם בדיקות שמבצעות אוטומציה של משימות ידניות של בקרת איכות באפליקציות לנייד, ומאפשרות אינטגרציה רציפה (CI) ואסטרטגיות בדיקה לפני השקת האפליקציה. לדוגמה, אפשר להשתמש בסקריפטים של Robo כדי לבדוק תרחיש נפוץ של משתמשים או לספק קלט ספציפי לממשק המשתמש, כמו שם משתמש וסיסמה. תסריטי Robo הם תכונה של Robo
test.
תסריטי Robo משתמשים ב-Robo test כמנוע הבדיקה. בצורה הבסיסית ביותר, סקריפט Robo מורכב מרצף של פעולות בממשק המשתמש, כמו הזנת הטקסט 'שם משתמש' ואז הקשה על הלחצן 'אישור'. סקריפטים של Robo יכולים לכלול גם פעולות כמו המתנה להופעת רכיב, הקשה בנקודה ספציפית בתוך רכיב והפעלת פקודות מעטפת של Android Debug Bridge (adb
).
לסקריפטים של Robo יש את היתרונות הבאים בהשוואה ל-frameworks מסורתיים של בדיקות:
יכולת
|
תיאור
|
אמינות גבוהה
|
סקריפטים של Robo יכולים להתמודד עם הבדלים משמעותיים במבנה ובהתנהגות בין גרסאות של אפליקציות, ועם חוסר יציבות של אפליקציות.
|
שאלה פתוחה
|
אחרי שתסריט Robo מסתיים, בדיקת Robo הבסיסית יכולה להשתלט ולהמשיך לבדוק את האפליקציה. הגישה הזו מאפשרת כמה תרחישי שימוש מרכזיים. לדוגמה, אפשר להשתמש בתסריט Robo כדי להעביר אפליקציה למצב מסוים על ידי ביצוע תהליך התחברות מותאם אישית.
|
עם הקלטה
|
לא צריך לקודד סקריפטים של Robo באופן ידני. אפשר להקליט אותם באמצעות הכלי להקלטת סקריפטים של Robo ב-Android Studio. בדרך כלל לא נדרש ידע בפיתוח לנייד כדי ליצור או לשנות סקריפטים של Robo.
|
גמיש
|
סקריפטים של Robo יכולים ליצור אינטראקציה עם רכיבי ממשק משתמש לא מקוריים שקיימים בדרך כלל במשחקים.
|
סקריפטים של Robo מופעלים באופן מותנה במהלך בדיקת Robo, מה שמאפשר למשתמשים לשפר את ההתנהגות של Robo – בדרך כלל כדי להשיג כיסוי רחב יותר או כדי לטרגט פונקציונליות ספציפית. בניגוד ל-frameworks מסורתיים לבדיקות, סקריפטים של Robo תומכים בפעולות הבאות:
- תנאי הפעלה שונים, למשל שם חבילה מסוים של אפליקציה פעיל (או לא) או אלמנט ספציפי מוצג על המסך (או לא).
- אמצעי בקרה על ההפעלה, למשל, מספר הפעמים המקסימלי להפעלה, עדיפות,
שלב הסריקה הרלוונטי.
- סוגי פעולות לא שגרתיים (מותנות, התעלמות מרכיב, סגירת מסך).
מומלץ להשתמש בסקריפטים של Robo כשאפשר, כי קל לתחזק אותם. לדוגמה, אפשר להשתמש בסקריפט Robo כדי:
- לנווט בתהליכי עבודה משמעותיים כדי להגיע לליבת הפונקציונליות של האפליקציה.
לדוגמה, אפשר לבצע כניסה, להגדיר את מצב האפליקציה אחרי ההפעלה הראשונה ולרשום משתמש חדש.
- כדי להפיק את המרב מזמן הבדיקה של Robo, כדאי להתמקד בחלק מסוים באפליקציה. סקריפט Robo מנחה את בדיקת Robo להגיע לחלק הרלוונטי באפליקציה,
שבו בדיקת Robo ממשיכה בסריקה אוטומטית מלאה.
- להעביר אפליקציה למצב או למסך ספציפיים כדי לבצע ניתוח. לדוגמה, כדי לנתח הודעה בתוך האפליקציה, מדיניות פרטיות או רמה ספציפית במשחק.
- מבצעים בדיקת מכשור מקצה לקצה, עם או בלי בדיקת Robo
וממשיכים בסריקה אוטומטית מלאה אחרי השלמת סקריפט Robo.
אפשר להשתמש בתכונות מתקדמות יותר של סקריפטים של Robo כדי לבצע את הפעולות הבאות:
- לבצע פעולות לפני ש-Robo מתחיל לסרוק את האפליקציה שנבדקת או אחרי שהסריקה מסתיימת, למשל, לנקות את הנתונים של האפליקציה שנבדקת לפני הסריקה או לשנות את הגדרות המכשיר.
- לשנות היבטים בהתנהגות של Robo במהלך סריקה, במיוחד:
- גורמים ל-Robo להתעלם מווידג'טים מסוימים בממשק המשתמש או ממסכים מסוימים באפליקציה.
- מציינים פעולה מותאמת אישית ש-Robo יבצע כשהוא יחזור ממסך מסוים.
- לגרום ל-Robo לבצע פעולות ספציפיות בכל פעם שמוצג מסך מסוים באפליקציה במהלך סריקה.
- התאמה אישית מלאה של האופן שבו Robo מבצע סריקה. לדוגמה, אפשר להשתמש בשילוב של פעולות מותנות ולא מותנות כדי להשאיר את האפליקציה שנבדקת ברקע לאורך הסריקה, תוך ביצוע מניפולציות במכשיר וסגירה של כל תיבת דו-שיח קופצת שמופיעה במהלך הסריקה.
חשוב לזכור שסקריפטים של Robo לא מחליפים את כל סוגי הבדיקות. עדיין צריך בדיקות יחידה כדי לזהות באגים בלוגיקה ברמה נמוכה באפליקציה. בדרך כלל, הבדיקות האלה לא דורשות סביבת Android או iOS. מומלץ להוסיף לבדיקות של סקריפטים של Robo בדיקות מכשור ממוקדות שיכולות לכלול טענות ספציפיות ומפורטות לגבי לוגיקה עסקית, שהדרך הכי טובה לבטא אותן היא באמצעות קוד.
השלבים הבאים
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-16 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-16 (שעון UTC)."],[],[],null,["\u003cbr /\u003e\n\nThis document describes how to use *Robo scripts* , which are tests that automate\nmanual QA tasks for mobile apps, and enable continuous integration (CI) and\npre-launch testing strategies. For example, you can use Robo scripts to test a\ncommon user journey or provide specific user interface (UI) input, like a\nusername and password. Robo scripts are a feature of [Robo\ntest](/docs/test-lab/ios/robo-ux-test).\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\nNext steps\n\n- To learn about Robo scripts structure, capabilities, usage, and actions, see\n the [Robo scripts reference guide](/docs/test-lab/android/robo-scripts-reference#ios-support-for-robo-scripts).\n\n- [Run a Robo test](/docs/test-lab/ios/robo-ux-test)."]]