SubprocessResultsReporter

public class SubprocessResultsReporter
extends Object implements ILogSaverListener, ISupportGranularResults, ITestInvocationListener

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


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

סיכום

יוצרים ציבוריים

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)

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

תתבצע קריאה אוטומטית על ידי framework של TradeFederation.

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

invocationFailed

public void invocationFailed (FailureDescription failure)

מדווח על הפעלה שלא הושלמה עקב מצב שגיאה כלשהו.

תתבצע קריאה אוטומטית על ידי framework של TradeFederation.

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

ההפעלה נכשלה

public void invocationFailed (Throwable cause)

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

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

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

ההפעלה התחילה

public void invocationStarted (IInvocationContext context)

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

תתבצע קריאה אוטומטית על ידי framework של 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) של המדדים שמונפקים

הבדיקה נכשלה

public void testFailed (TestDescription testId, 
                FailureDescription failure)

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

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

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

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

הבדיקה נכשלה

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 שמתאר את הסיבה לכישלון ההרצה.

בדיקת ההרצה

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 שמוצגים כמה פעמים. ה-TryNumber כולל 0 אינדקס, והוא אמור לגדול בכל פעם שמתרחשת הפעלה חדשה. למשל, בדיקה מפורטת מתבצעת שוב 3 פעמים, והבדיקה צריכה לכלול 4 הפעלות בסך הכל תחת אותו runName, ו-TryNumber הוא בין 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: מזהה את הבדיקה