TestResultListener

public abstract class TestResultListener
extends Object implements ITestLifeCycleReceiver

java.lang.Object
   ↳ com.android.tradefed.result.TestResultListener


פישוט של ITestLifecycleListener למטמיעים שמתעניינים רק בתוצאות של בדיקות ספציפיות.

הוא מסנן את אירועי מחזור החיים השונים עד לשיטה testResult.

היא לא בטוחה לשרשור, ובמיוחד היא מניחה שהאירועים של ITestLifecycleListener מתקבלים בסדר.

סיכום

קונסטרוקטורים גלויים לכולם

TestResultListener()

שיטות ציבוריות

final void testAssumptionFailure(TestDescription test, String trace)

הקריאה מתבצעת כשבדיקה אטומית מסמנת שהיא מניחה תנאי שהוא שקר

final void testEnded(TestDescription test, testMetrics)

דיווח על סיום הביצוע של מקרה בדיקה ספציפי.

final void testEnded(TestDescription test, long endTime, testMetrics)

חלופה ל-ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)), שבה אפשר לציין את שעת הסיום ישירות.

final void testFailed(TestDescription test, String trace)

דיווח על כשל של מקרה בדיקה ספציפי.

final void testIgnored(TestDescription test)

הקריאה מתבצעת כשבדיקה לא מופעלת, בדרך כלל כי השיטה לבדיקה מסומנת ב-org.junit.Ignore.

abstract void testResult(TestDescription test, TestResult result)
void testRunEnded(long elapsedTimeMillis, runMetrics)

דיווח על סיום הרצת הבדיקה.

void testSkipped(TestDescription test, SkipReason reason)

הקריאה מתבצעת כשבדיקה מופעלת ולא מתבצעת מסיבה שלא צפויה בדרך כלל.

final void testStarted(TestDescription test, long startTime)

חלופה ל-testStarted(com.android.tradefed.result.TestDescription) שבה מציינים גם את מועד ההתחלה של הבדיקה, בשילוב עם ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) למדידה מדויקת.

final void testStarted(TestDescription test)

דיווח על התחלת מקרה בדיקה ספציפי.

קונסטרוקטורים גלויים לכולם

TestResultListener

public TestResultListener ()

שיטות ציבוריות

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                String trace)

הקריאה מתבצעת כשבדיקה אטומית מסמנת שהיא מניחה תנאי שהוא שקר

פרמטרים
test TestDescription: מזהה את הבדיקה

trace String: סטאק טריי של הכשל

testEnded

public final void testEnded (TestDescription test, 
                 testMetrics)

דיווח על סיום הביצוע של מקרה בדיקה ספציפי.

אם לא הופעל testFailed(TestDescription, FailureDescription), הבדיקה הזו עברה. הפונקציה מחזירה גם מדדים מסוג מפתח/ערך שעשויים להופיע במהלך ביצוע מקרה הבדיקה.

פרמטרים
test TestDescription: מזהה את הבדיקה

testMetrics : ERROR(/Map) של המדדים שמונפקים

testEnded

public final void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

חלופה ל-ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)), שבה אפשר לציין את שעת הסיום ישירות. כדי לקבל מדידה מדויקת, כדאי לשלב את הקוד עם testStarted(com.android.tradefed.result.TestDescription, long).

פרמטרים
test TestDescription: מזהה את הבדיקה

endTime long: השעה שבה הסתיים הבדיקה, נמדדת באמצעות System.currentTimeMillis()

testMetrics : ERROR(/Map) של המדדים שמונפקים

testFailed

public final void testFailed (TestDescription test, 
                String trace)

דיווח על כשל של מקרה בדיקה ספציפי.

הקריאה תתבצע בין testStarted ל-testEnded.

פרמטרים
test TestDescription: מזהה את הבדיקה

trace String: סטאק טריי של הכשל

testIgnored

public final void testIgnored (TestDescription test)

הקריאה מתבצעת כשבדיקה לא מופעלת, בדרך כלל כי השיטה לבדיקה מסומנת ב-org.junit.Ignore.

פרמטרים
test TestDescription: מזהה את הבדיקה

testResult

public abstract void testResult (TestDescription test, 
                TestResult result)

פרמטרים
test TestDescription

result TestResult

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

דיווח על סיום הרצת הבדיקה.

פרמטרים
elapsedTimeMillis long: הזמן שחלף שדווח על ידי המכשיר, באלפיות השנייה

runMetrics : צמדי מפתח/ערך שמדווחים בסוף הרצה של בדיקה

testSkipped

public void testSkipped (TestDescription test, 
                SkipReason reason)

הקריאה מתבצעת כשבדיקה מופעלת ולא מתבצעת מסיבה שלא צפויה בדרך כלל. יתבצעו ניסיונות חוזרים של הבדיקות האלה כדי לנסות לבצע אותן כראוי.

פרמטרים
test TestDescription: מזהה את הבדיקה

reason SkipReason: SkipReason

testStarted

public final void testStarted (TestDescription test, 
                long startTime)

חלופה ל-testStarted(com.android.tradefed.result.TestDescription) שבה מציינים גם את מועד ההתחלה של הבדיקה, בשילוב עם ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) למדידה מדויקת.

פרמטרים
test TestDescription: מזהה את הבדיקה

startTime long: השעה שבה הבדיקה התחילה, נמדדת באמצעות System.currentTimeMillis()

testStarted

public final void testStarted (TestDescription test)

דיווח על התחלת מקרה בדיקה ספציפי. ממשק ישן יותר, עדיף להשתמש ב-testStarted(com.android.tradefed.result.TestDescription) כשהדבר אפשרי.

פרמטרים
test TestDescription: מזהה את הבדיקה