SubprocessResultsReporter
public class SubprocessResultsReporter
extends Object
implements ITestInvocationListener , ILogSaverListener , ISupportGranularResults
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) במקרים מסוימים, יומן חייב להיות משויך מאוד למקרי בדיקה, אך ההזדמנות לעשות זאת ב- |
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) testEnded ( TestDescription testId, long endTime, metrics) חלופה ל- |
void | testEnded ( TestDescription testId, metrics) 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) testRunEnded (long time, runMetrics) מדווח על סיום ריצת המבחן. |
void | testRunFailed ( FailureDescription failure) ריצת בדיקת הדוחות לא הושלמה עקב כשל המתואר על ידי |
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) חלופה ל- |
void | testStarted ( TestDescription testId) מדווח על תחילת מקרה בדיקה בודד. |
בנאים ציבוריים
SubprocessResultsReporter
public SubprocessResultsReporter ()
שיטות ציבוריות
סגור
public void close ()
getSummary
public TestSummary getSummary ()
מאפשר ל-InvocationListener להחזיר סיכום.
החזרות | |
---|---|
TestSummary | TestSummary המסכם את הריצה, או null |
הקריאה הסתיימה
public void invocationEnded (long elapsedTime)
מדווח שהפנייה הסתיימה, בין אם בהצלחה ובין אם עקב מצב שגיאה כלשהו.
ייקרא אוטומטית על ידי מסגרת TradeFederation.
פרמטרים | |
---|---|
elapsedTime | long : הזמן שחלף של הקריאה ב-ms |
הפניה נכשלה
public void invocationFailed (FailureDescription failure)
מדווח על הזמנה לא מלאה עקב מצב שגיאה כלשהו.
ייקרא אוטומטית על ידי מסגרת TradeFederation.
פרמטרים | |
---|---|
failure | FailureDescription : FailureDescription המתאר את הסיבה לכשל |
הפניה נכשלה
public void invocationFailed (Throwable cause)
מדווח על הזמנה לא מלאה עקב מצב שגיאה כלשהו.
ייקרא אוטומטית על ידי מסגרת TradeFederation.
פרמטרים | |
---|---|
cause | Throwable : הגורם Throwable לכשל |
התראה התחילה
public void invocationStarted (IInvocationContext context)
מדווח על תחילת הזמנת הבדיקה.
ייקרא אוטומטית על ידי מסגרת TradeFederation. כתבים צריכים לעקוף שיטה זו כדי לתמוך בדיווח על מספר מכשירים.
פרמטרים | |
---|---|
context | IInvocationContext : מידע על הפנייה |
logAssociation
public void logAssociation (String dataName, LogFile logFile)
במקרים מסוימים, יומן חייב להיות משויך מאוד למקרי בדיקה, אך ההזדמנות לעשות זאת ב- testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)
התקשרות חוזרת אינה אפשרית. לפיכך, התקשרות חוזרת זו מאפשרת לספק קשר חזק במפורש.
פרמטרים | |
---|---|
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 |
תומך ב-GranularResults
public boolean supportGranularResults ()
מחזירה True אם הכתב תומך בתוצאות מפורטות, false אחרת.
החזרות | |
---|---|
boolean |
testAssumption Failure
public void testAssumptionFailure (TestDescription testId, String trace)
נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי
פרמטרים | |
---|---|
testId | TestDescription : מזהה את הבדיקה |
trace | String : עקבות מחסנית של כישלון |
testAssumption Failure
public void testAssumptionFailure (TestDescription testId, FailureDescription failure)
נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי
פרמטרים | |
---|---|
testId | TestDescription : מזהה את הבדיקה |
failure | FailureDescription : FailureDescription המתאר את הכישלון ואת ההקשר שלו. |
הבדיקה הסתיים
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) של המדדים הנפלטים |
הבדיקה הסתיים
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 : עקבות מחסנית של כישלון |
התעלמו מהבדיקה
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 אינו ייחודי לכל הזמנה. כלומר, המיישמים חייבים להיות מסוגלים לטפל במספר שיחות עם אותו dataName |
dataType | LogDataType : LogDataType של הנתונים |
dataStream | InputStreamSource : InputStreamSource של הנתונים. על המיישמים להתקשר ל-createInputStream כדי להתחיל לקרוא את הנתונים, ולהבטיח לסגור את ה-InputStream שהתקבל לאחר השלמתו. המתקשרים צריכים לוודא שמקור הנתונים נשאר קיים ונגיש עד להשלמת שיטת testLog. |
testModuleEnded
public void testModuleEnded ()
מדווח על סיום הפעלת מודול.
testModuleStarted
public void testModuleStarted (IInvocationContext moduleContext)
מדווח על תחילת מודול פועל. התקשרות חוזרת זו משויכת ל- testModuleEnded()
והיא אופציונלית ברצף. הוא משמש רק במהלך ריצה המשתמשת במודולים: רצים מבוססי סוויטה.
פרמטרים | |
---|---|
moduleContext | IInvocationContext : IInvocationContext של המודול. |
testRunEnded
public void testRunEnded (long time,runMetrics)
מדווח על סיום ריצת המבחן. FIXME: אין לנו שני ממשקי Map<> עם סוג שונה, אז עלינו להשתמש ב-HashMap כאן.
פרמטרים | |
---|---|
time | long : המכשיר דיווח על זמן שחלף, באלפיות שניות |
runMetrics | Metric . |
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 הפועלים מספר פעמים. ה-probyNumber הוא 0 באינדקס ואמור לעלות בכל פעם שמתרחשת ריצה חדשה. לדוגמה, בדיקה מפורטת חוזרת 3 פעמים, היא צריכה לכלול 4 ריצות בסך הכל תחת אותו runName וה-probationNumber הוא מ-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 הפועלים מספר פעמים. ה-probyNumber הוא 0 באינדקס ואמור לעלות בכל פעם שמתרחשת ריצה חדשה. לדוגמה, בדיקה מפורטת חוזרת 3 פעמים, היא צריכה לכלול 4 ריצות בסך הכל תחת אותו runName וה-probationNumber הוא מ-0 עד 3. |
startTime | long : הזמן שבו התחילה הריצה, נמדד באמצעות System.currentTimeMillis() |
testRunStopped
public void testRunStopped (long arg0)
הפעלת בדיקת הדוחות הופסקה לפני השלמתה עקב בקשת משתמש.
מטלה: לא בשימוש כרגע, שקול להסיר
פרמטרים | |
---|---|
arg0 | long : המכשיר דיווח על זמן שחלף, באלפיות שניות |
דילוג על הבדיקה
public void testSkipped (TestDescription testId, SkipReason reason)
נקרא כאשר מדלגים על בדיקה ולא בוצעה מסיבה שאינה צפויה בדרך כלל. בדיקות אלו ינוסו לנסות שוב כדי לנסות לבצע ביצוע תקין.
פרמטרים | |
---|---|
testId | TestDescription : מזהה את הבדיקה |
reason | SkipReason : SkipReason |
הבדיקה התחילה
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() |
הבדיקה התחילה
public void testStarted (TestDescription testId)
מדווח על תחילת מקרה בדיקה בודד. ממשק ישן יותר, צריך להשתמש testStarted(com.android.tradefed.result.TestDescription)
במידת האפשר.
פרמטרים | |
---|---|
testId | TestDescription : מזהה את הבדיקה |