ILogSaverListener

public interface ILogSaverListener
implements ITestInvocationListener

com.android.tradefed.result.ILogSaverListener


מאפשר ל-ITestInvocationListener להאזין למצב שבו קובצי יומן נשמרים.

השיטה הזו מאפשרת לכמה ITestInvocationListener להשתמש באותו קובץ יומן שנשמר כשמפיקים דוחות, ומונעת מצב שבו כל מאזין שומר את הקובץ בנפרד כשמתבצעת קריאה ל-ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource).

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

בנוסף, המחלקה הזו מעבירה את המופע הגלובלי ILogSaver כדי ש-ITestInvocationListener יוכל לשמור קבצים נוספים באותו מיקום.

סיכום

‫methods ציבוריים

default void logAssociation(String dataName, LogFile logFile)

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

default void setLogSaver(ILogSaver logSaver)

מגדירים את ILogSaver כדי לאפשר למטמיע לשמור קבצים.

default void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

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

‫methods ציבוריים

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 שנרשם קודם וצריך להיות משויך לתרחיש הבדיקה.

setLogSaver

public void setLogSaver (ILogSaver logSaver)

מגדירים את ILogSaver כדי לאפשר למטמיע לשמור קבצים.

פרמטרים
logSaver ILogSaver: ILogSaver

testLogSaved

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

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

צריך להשתמש בה במקום ITestInvocationListener.testLog(String, LogDataType, InputStreamSource).

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

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

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

logFile LogFile: LogFile שמכיל את המטא-נתונים של הקובץ שנשמר.