با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این سند نحوه استفاده از اسکریپتهای Robo را شرح میدهد، که آزمایشهایی هستند که وظایف QA دستی را برای برنامههای تلفن همراه خودکار میکنند و یکپارچهسازی مداوم (CI) و استراتژیهای آزمایش پیش از راهاندازی را فعال میکنند. برای مثال، میتوانید از اسکریپتهای Robo برای آزمایش سفر مشترک کاربر یا ارائه ورودی رابط کاربری خاص (UI) مانند نام کاربری و رمز عبور استفاده کنید. اسکریپت های Robo یکی از ویژگی های تست Robo هستند.
اسکریپت های Robo از تست Robo به عنوان موتور تست استفاده می کنند. در ابتداییترین شکل آن، یک اسکریپت Robo متشکل از دنبالهای از اقدامات رابط کاربری است، مانند وارد کردن متن «نام کاربری» و سپس ضربه زدن روی دکمه تأیید . اسکریپتهای Robo همچنین میتوانند شامل اقداماتی مانند انتظار برای ظاهر شدن یک عنصر، ضربه زدن روی یک نقطه خاص در یک عنصر، و اجرای دستورات پوسته Android Debug Bridge ( adb ) باشند.
اسکریپت های Robo دارای مزایای زیر نسبت به چارچوب های آزمایشی سنتی هستند:
قابلیت
توضیحات
بسیار مقاوم
اسکریپتهای Robo میتوانند تفاوتهای ساختاری و رفتاری قابلتوجهی بین نسخههای برنامه و پوسته پوسته شدن برنامه را تحمل کنند.
پایان باز
پس از تکمیل اسکریپت Robo، تست پایه Robo میتواند برنامه را کنترل کند و به آزمایش آن ادامه دهد. این رویکرد آزمایش مداوم چندین مورد استفاده کلیدی را امکان پذیر می کند. برای مثال، میتوانید از یک اسکریپت Robo برای آوردن یک برنامه به یک وضعیت خاص با انجام یک جریان ورود سفارشی استفاده کنید.
قابل ضبط
شما نیازی به کدنویسی دستی اسکریپت های Robo ندارید. آنها را می توان با استفاده از ضبط کننده اسکریپت Robo در Android Studio ضبط کرد. ایجاد یا اصلاح اسکریپت های Robo معمولاً نیازی به دانش توسعه موبایل ندارد.
انعطاف پذیر
اسکریپتهای Robo میتوانند با عناصر UI غیر بومی که در بازیها رایج هستند، تعامل داشته باشند.
اسکریپتهای Robo به صورت مشروط در طول تست Robo فعال میشوند، که به کاربران امکان میدهد رفتار Robo را تقویت کنند - معمولاً برای دستیابی به پوشش بیشتر یا عملکرد خاص هدف. برخلاف چارچوبهای تست سنتی، اسکریپتهای Robo از موارد زیر پشتیبانی میکنند:
شرایط راهاندازی مختلف، بهعنوان مثال، فعال بودن (یا نبودن) یک نام بسته برنامه خاص یا نمایش یک عنصر خاص روی صفحه (یا نه).
کنترل های اجرا، به عنوان مثال، حداکثر تعداد اجرا، اولویت، مرحله خزیدن مربوطه.
انواع اقدام غیر متعارف (شرطی، نادیده گرفتن عناصر، بسته شدن صفحه).
توصیه می کنیم در صورت امکان از اسکریپت های Robo استفاده کنید زیرا می توان آنها را بدون زحمت نگهداری کرد. به عنوان مثال، می توانید از اسکریپت Robo برای انجام کارهای زیر استفاده کنید:
برای رسیدن به هسته عملکرد یک برنامه، در جریانهای کاری مهم پیمایش کنید. به عنوان مثال، می توانید یک ورود به سیستم انجام دهید، وضعیت یک برنامه را پس از اولین راه اندازی تنظیم کنید، و یک کاربر جدید ثبت کنید.
Robo را روی قسمت خاصی از یک برنامه متمرکز کنید تا از زمان تست Robo حداکثر استفاده را ببرید. Robo اسکریپت تست Robo را برای رسیدن به بخش مربوطه یک برنامه راهنمایی می کند، جایی که تست Robo یک خزیدن کاملاً خودکار را از سر می گیرد.
برای انجام تجزیه و تحلیل، یک برنامه را به یک وضعیت یا صفحه نمایش خاص بیاورید، به عنوان مثال، برای تجزیه و تحلیل یک پیام درون برنامه، خط مشی رازداری، یا سطح خاصی از یک بازی.
یک تست ابزار دقیق، با یا بدون تست Robo انجام دهید و پس از تکمیل اسکریپت Robo، خزیدن کاملاً خودکار را از سر بگیرید.
از ویژگی های پیشرفته تر Robo script برای انجام کارهای زیر استفاده کنید:
قبل از اینکه Robo شروع به خزیدن در برنامه تحت آزمایش یا پس از پایان خزیدن کند، اقداماتی را انجام دهید، برای مثال، دادههای برنامه تحت آزمایش را قبل از خزیدن پاک کنید یا تنظیمات دستگاه را تغییر دهید.
تغییر جنبه های رفتار روبو در طول خزیدن، به ویژه:
کاری کنید که Robo برخی ویجتهای رابط کاربری یا صفحههای برنامه را نادیده بگیرد.
یک عمل سفارشی برای Robo ارائه دهید تا هنگام عقبگرد از یک صفحه خاص انجام دهد.
هر زمان که در حین خزیدن با صفحه برنامه خاصی مواجه شد، Robo را وادار کنید تا اقدامات خاصی را انجام دهد.
نحوه انجام خزیدن Robo را کاملاً سفارشی کنید. به عنوان مثال، از ترکیبی از کنشهای شرطی و غیرشرطی برای نگه داشتن برنامه تحت آزمایش در پسزمینه در طول خزیدن استفاده کنید، در حالی که دستکاریهای دستگاه را انجام میدهید و هر پنجره بازشوی را که در طول مسیر ظاهر میشود حذف کنید.
به خاطر داشته باشید که اسکریپت های Robo جایگزین انواع تست ها نمی شوند. شما هنوز به تست های واحد نیاز دارید تا باگ های منطقی سطح پایین را در برنامه خود پیدا کنید. این تست ها معمولاً به محیط اندروید یا iOS نیاز ندارند. توصیه میکنیم تستهای اسکریپت Robo را با تستهای ابزار دقیقی تکمیل کنید که میتوانند ادعاهای خاص و مفصلی در مورد منطق کسبوکار داشته باشند، که به بهترین شکل در کد بیان میشوند.
مراحل بعدی
برای آشنایی با ساختار، قابلیتها، استفاده و اقدامات Robo Scripts، به راهنمای مرجع Robo scripts مراجعه کنید.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-04 بهوقت ساعت هماهنگ جهانی."],[],[],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)."]]