SubprocessResultsReporter

public class SubprocessResultsReporter
extends Object implements ILogSaverListener, ISupportGranularResults, ITestInvocationListener

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


הטמעת ITestInvocationListener כדי לציין אותו בתור result_reporter, ולהעביר מהתהליך המשני את התוצאות של הבדיקות, הפעלות הבדיקות והפעלות הבדיקות.

סיכום

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

SubprocessResultsReporter()

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

void close()

TestSummary getSummary()

מאפשר ל-InvocationListener להחזיר סיכום.

void invocationEnded(long elapsedTime)

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

void invocationFailed(FailureDescription failure)

דיווח על קריאה חלקית עקב תנאי שגיאה כלשהו.

void invocationFailed(Throwable cause)

דיווח על קריאה חלקית עקב תנאי שגיאה כלשהו.

void invocationStarted(IInvocationContext context)

דיווח על התחלת ההפעלה של הבדיקה.

void logAssociation(String dataName, LogFile logFile)

במקרים מסוימים, צריך לשייך את היומן באופן חזק למקרה בדיקה, אבל אי אפשר לעשות זאת בקריאה החוזרת (callback) הישירה של testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile).

void printEvent(String key, Object event)

פונקציית עזרה להדפסת מפתח האירוע ואז את אובייקט ה-JSON.

void setOutputTestLog(boolean outputTestLog)

מגדיר אם להציג את הפלט של הבדיקה ביומן או לא.

boolean supportGranularResults()

הפונקציה מחזירה את הערך True אם הכלי לדיווח תומך בתוצאות מפורטות, ואת הערך False במקרים אחרים.

void testAssumptionFailure(TestDescription testId, String trace)

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

void testAssumptionFailure(TestDescription testId, FailureDescription failure)

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

void testEnded(TestDescription testId, long endTime, metrics)

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

void testEnded(TestDescription testId, metrics)

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

void testFailed(TestDescription testId, FailureDescription failure)

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

void testFailed(TestDescription testId, String reason)

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

void testIgnored(TestDescription testId)

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

void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

הנתונים המשויכים של היומן או ניפוי הבאגים מהפעלת הבדיקה.

void testModuleEnded()

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

void testModuleStarted(IInvocationContext moduleContext)

האירוע הזה מדווח על תחילת ההרצה של מודול.

void testRunEnded(long time, runMetrics)

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

void testRunFailed(FailureDescription failure)

הרצת הבדיקה של הדוחות נכשלה בגלל כשל שמתואר ב-FailureDescription.

void testRunFailed(String reason)

הרצת הבדיקה של הדוחות נכשלה בגלל שגיאה קטלנית.

void testRunStarted(String runName, int testCount, int attemptNumber)

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

void testRunStarted(String runName, int testCount)

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

void testRunStarted(String runName, int testCount, int attemptNumber, long startTime)

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

void testRunStopped(long arg0)

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

void testSkipped(TestDescription testId, SkipReason reason)

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

void testStarted(TestDescription testId, long startTime)

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

void testStarted(TestDescription testId)

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

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

SubprocessResultsReporter

public SubprocessResultsReporter ()

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

סגירה

public void close ()

getSummary

public TestSummary getSummary ()

מאפשר ל-InvocationListener להחזיר סיכום.

החזרות
TestSummary TestSummary שמסכם את ההרצה, או null

invocationEnded

public void invocationEnded (long elapsedTime)

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

הקריאה תתבצע באופן אוטומטי על ידי מסגרת TradeFederation.

פרמטרים
elapsedTime long: הזמן שחלף מהקריאה, במילישניות

invocationFailed

public void invocationFailed (FailureDescription failure)

דיווח על קריאה חלקית עקב תנאי שגיאה כלשהו.

הקריאה תתבצע באופן אוטומטי על ידי מסגרת TradeFederation.

פרמטרים
failure FailureDescription: ה-FailureDescription שמתאר את הסיבה לכישלון

invocationFailed

public void invocationFailed (Throwable cause)

דיווח על קריאה חלקית עקב תנאי שגיאה כלשהו.

הקריאה תתבצע באופן אוטומטי על ידי מסגרת TradeFederation.

פרמטרים
cause Throwable: Throwable הסיבה לכישלון

invocationStarted

public void invocationStarted (IInvocationContext context)

דיווח על התחלת ההפעלה של הבדיקה.

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

פרמטרים
context IInvocationContext: מידע על ההפעלה

logAssociation

public void logAssociation (String dataName, 
                LogFile logFile)

במקרים מסוימים, צריך לשייך את היומן באופן חזק למקרה בדיקה, אבל אי אפשר לעשות זאת בקריאה החוזרת (callback) הישירה של testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile). כך, קריאה חוזרת (callback) מאפשרת לספק באופן מפורש שיוך חזק.

פרמטרים
dataName String: השם של הנתונים

logFile LogFile: ה-LogFile שרשום ביומן קודם וצריך לשייך למקרה הבדיקה.

printEvent

public void printEvent (String key, 
                Object event)

פונקציית עזרה להדפסת מפתח האירוע ואז את אובייקט ה-JSON.

פרמטרים
key String

event Object

setOutputTestLog

public void setOutputTestLog (boolean outputTestLog)

מגדיר אם להציג את הפלט של הבדיקה ביומן או לא.

פרמטרים
outputTestLog boolean

supportGranularResults

public boolean supportGranularResults ()

הפונקציה מחזירה את הערך True אם הכלי לדיווח תומך בתוצאות מפורטות, ואת הערך False במקרים אחרים.

החזרות
boolean

testAssumptionFailure

public void testAssumptionFailure (TestDescription testId, 
                String trace)

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

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

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

testAssumptionFailure

public void testAssumptionFailure (TestDescription testId, 
                FailureDescription failure)

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

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

failure FailureDescription: FailureDescription שמתאר את התקלה ואת ההקשר שלה.

testEnded

public void testEnded (TestDescription testId, 
                long endTime, 
                 metrics)

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

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

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

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

testEnded

public void testEnded (TestDescription testId, 
                 metrics)

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

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

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

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

testFailed

public void testFailed (TestDescription testId, 
                FailureDescription failure)

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

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

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

failure FailureDescription: FailureDescription שמתאר את התקלה ואת ההקשר שלה.

testFailed

public void testFailed (TestDescription testId, 
                String reason)

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

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

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

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

testIgnored

public void testIgnored (TestDescription testId)

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

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

testLog

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

הנתונים המשויכים של היומן או ניפוי הבאגים מהפעלת הבדיקה.

צריך להפעיל את הפונקציה לפני ERROR(/ITestInvocationListener#invocationFailed(Throwable)) או ERROR(/ITestInvocationListener#invocationEnded(long))

מסגרת TradeFederation תבצע קריאה אוטומטית לשיטה הזו, ותספק את יומן המארח ואם רלוונטי, את logcat של המכשיר.

פרמטרים
dataName String: String שם תיאורי של הנתונים. לדוגמה, 'device_logcat'. הערה: שם המשתנה dataName לא חייב להיות ייחודי לכל קריאה. כלומר, למטמיעים צריכה להיות אפשרות לטפל בכמה קריאות עם אותו שם משתנה

dataType LogDataType: ה-LogDataType של הנתונים

dataStream InputStreamSource: ה-InputStreamSource של הנתונים. מי שמטמיע את הקוד צריך להפעיל את createInputStream כדי להתחיל לקרוא את הנתונים, ולוודא שהוא סוגר את ה-InputStream שנוצר בסיום. מבצעי הקריאה צריכים לוודא שמקור הנתונים יישאר נוכח וזמין עד להשלמת השיטה testLog.

testModuleEnded

public void testModuleEnded ()

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

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

האירוע הזה מדווח על תחילת ההרצה של מודול. קריאת החזרה (callback) הזו משויכת ל-testModuleEnded() והיא אופציונלית בסדרה. הוא משמש רק במהלך ריצה שמשתמשת במודולים: כלי ריצה מבוססי-חבילות.

פרמטרים
moduleContext IInvocationContext: ה-IInvocationContext של המודול.

testRunEnded

public void testRunEnded (long time, 
                 runMetrics)

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

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

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

testRunFailed

public void testRunFailed (FailureDescription failure)

הרצת הבדיקה של הדוחות נכשלה בגלל כשל שמתואר ב-FailureDescription.

פרמטרים
failure FailureDescription: FailureDescription שמתאר את התקלה ואת ההקשר שלה.

testRunFailed

public void testRunFailed (String reason)

הרצת הבדיקה של הדוחות נכשלה בגלל שגיאה קטלנית.

פרמטרים
reason String: String שמתאר את הסיבה לכישלון ההרצה.

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber)

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

פרמטרים
runName String: שם ההרצה לניסיון

testCount int: המספר הכולל של הבדיקות בהרצה לניסיון

attemptNumber int: מספר הזמנה, שמזהה את הניסיונות השונים של אותו runName שירוצו כמה פעמים. הערך של attemptNumber מתחיל ב-0 וצריך לעלות בכל פעם שמתבצעה הפעלה חדשה. לדוגמה, אם מתבצעות 3 ניסיונות מפורטים של בדיקה, צריכות להיות לה 4 הפעלות בסך הכול באותו runName, והערך של attemptNumber יהיה בין 0 ל-3.

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

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

פרמטרים
runName String: שם ההרצה לניסיון

testCount int: המספר הכולל של הבדיקות בהרצה לניסיון

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber, 
                long startTime)

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

פרמטרים
runName String: שם ההרצה לניסיון

testCount int: המספר הכולל של הבדיקות בהרצה לניסיון

attemptNumber int: מספר הזמנה, שמזהה את הניסיונות השונים של אותו runName שירוצו כמה פעמים. הערך של attemptNumber מתחיל ב-0 וצריך לעלות בכל פעם שמתבצעה הפעלה חדשה. לדוגמה, אם ניסוי מסוים מנסה שוב 3 פעמים ברמת פירוט גבוהה, צריכות להיות לו 4 הפעלות בסך הכול באותו runName, והערך של attemptNumber יהיה בין 0 ל-3.

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

testRunStopped

public void testRunStopped (long arg0)

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

TODO: currently unused, consider removing

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

testSkipped

public void testSkipped (TestDescription testId, 
                SkipReason reason)

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

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

reason SkipReason: SkipReason

testStarted

public void testStarted (TestDescription testId, 
                long startTime)

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

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

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

testStarted

public void testStarted (TestDescription testId)

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

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