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

סיכום

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

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)

בוצעה קריאה כשיומן הבדיקה נשמר.

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

שיוך (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 כדי להתחיל לקרוא את הנתונים, ולוודא לסגור את StreamStream לאחר השלמת הפעולה.

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