اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
إنشاء أداة إعداد تقارير النتائج
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توضّح هذه الصفحة أساسيات كيفية تنفيذ أداة جديدة لإعداد تقارير النتائج و
ضبطها لإجراء اختبار.
الواجهة الأساسية
لتحديد أداة جديدة لتسجيل النتائج في Tradefed، يجب أن تنفِّذ الفئة
واجهة
ITestInvocationListener
التي تسمح بتلقّي مراحل مختلفة من
الاستدعاء ومعالجتها:
invocationStarted
invocationEnded
invocationFailed
يتعامل مُعدّو تقارير النتائج أيضًا مع المراحل المختلفة لكلّ عملية إجراء اختبار:
testRunStarted
testStarted
-
testFailed
أو testIgnored
testEnded
testRunFailed
testRunEnded
استنادًا إلى كل هذه الأحداث، هناك نوعان رئيسيان من تقارير النتائج، وهما:
- لا تهتم إلا بإعداد تقارير عن النتائج النهائية الكاملة فقط.
- اتّخاذ إجراء بشأن النتائج الجزئية
أداة إعداد تقارير النتائج التي تُبلغ عن النتائج النهائية الكاملة
هذا النوع هو الأكثر شيوعًا عندما يتعلق الأمر بالتفاعل مع
خدمة خارجية تتلقّى النتائج. يتلقّى مُرسِل التقارير ببساطة النتيجة ويجمعها ويرسلها كلها على invocationEnded
إلى نقطة نهاية النتيجة.
ننصحك بأن يوفّر هؤلاء المُبلِّغون CollectingTestListener
بدلاً
من الواجهة الأساسية لتجنُّب إعادة تنفيذ حفظ
النتائج وتخزينها إلى أن يتم طرح invocationEnded
.
أداة إعداد تقارير النتائج التي تُبلغ عن نتائج جزئية
يُستخدَم هذا النوع عادةً لبث النتائج، وذلك عند تلقّي النتائج
وإرسالها إلى بعض الأماكن الأخرى على الفور. على سبيل المثال، يكون مُرسِل التقارير
الذي يسجّل النتائج في وحدة التحكّم من هذا النوع.
يشير هذا النوع إلى نوع المعالجة المطلوب في الأحداث،
لذلك يُنصح عادةً بتنفيذ الواجهة الأساسية.
إعدادات XML
علامة العنصر هي result_reporter
. مثلاً:
<result_reporter class="com.android.tradefed.result.ConsoleResultReporter">
<option name="suppress-passed-tests" value="true"/>
</result_reporter>
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Create a result reporter\n\nThis page describes the basics of how to implement a new result reporter and\nconfigure it for a test.\n\nCore interface\n--------------\n\nIn order to define a new result reporter in Tradefed, a class must implement\nthe\n[`ITestInvocationListener`](https://android.googlesource.com/platform/tools/tradefederation/+/refs/heads/android16-release/invocation_interfaces/com/android/tradefed/result/ITestInvocationListener.java)\ninterface that allows receiving and handling different stages of the\ninvocation:\n\n- `invocationStarted`\n- `invocationEnded`\n- `invocationFailed`\n\nResult reporters also handle the different stages of each test run:\n\n- `testRunStarted`\n- `testStarted`\n- `testFailed` or `testIgnored`\n- `testEnded`\n- `testRunFailed`\n- `testRunEnded`\n\nGiven all these events, there are two main types of result reporters, those that:\n\n- Care only about reporting the final complete results.\n- Take action on partial results.\n\n### Result reporter that reports final complete results\n\nThis type is the most common case when it comes to interacting with an external\nservice that receives the results. The reporter simply receives and accumulates\nthe results and then sends them all on `invocationEnded` to the result end-point.\n\nWe recommend that those reporters extend `CollectingTestListener` instead\nof the base interface in order to avoid reimplementing saving and storing the\nresults until `invocationEnded`.\n\n### Result reporter that reports partial results\n\nThis type is usually used for a streaming approach of the results, when results\nare received and pushed to some other places right away. For example, a reporter\nthat logs the results to the console would be of this type.\n\nThis type is specific to which type of handling is required on the events,\nso implementing the base interface is usually the recommended way.\n\n### XML configuration\n\nThe object tag is `result_reporter`. For example: \n\n \u003cresult_reporter class=\"com.android.tradefed.result.ConsoleResultReporter\"\u003e\n \u003coption name=\"suppress-passed-tests\" value=\"true\"/\u003e\n \u003c/result_reporter\u003e"]]