ModuleListener

public class ModuleListener
extends CollectingTestListener

java.lang.Object
   ↳ com.android.tradefed.result.CollectingTestListener
     ↳ com.android.tradefed.testtype.suite.ModuleListener


מאזין שמצורף לכל IRemoteTest של כל מודול כדי לאסוף את רשימת התוצאות.

סיכום

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

ModuleListener(ITestInvocationListener listener, IInvocationContext moduleContext)

יוצר.

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

boolean hasLastAttemptFailed()

הפונקציה מחזירה אם ניסיון הניסיון האחרון של המאזין נכשל או לא.

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 setAttemptIsolation(CurrentInvocation.IsolationGrade isolation)

מגדיר אם הניסיון ידווח כאירוע בודד או לא.

void setCollectTestsOnly(boolean collectTestsOnly)

ההגדרה קובעת אם אנחנו אוספים רק את הבדיקות או לא.

void setMarkTestsSkipped(boolean skip)

האם לסמן את כל תרחישי הבדיקה כמחויבים לדילוג.

void setTestMappingSources( testMappingSources)

מגדיר מקורות למיפוי בדיקות שיוזנו למדדים.

void testAssumptionFailure(TestDescription test, String trace)

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

void testAssumptionFailure(TestDescription test, FailureDescription failure)

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

void testEnded(TestDescription test, long endTime, testMetrics)

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

void testEnded(TestDescription test, testMetrics)

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

void testFailed(TestDescription test, FailureDescription failure)

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

void testFailed(TestDescription test, String trace)

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

void testIgnored(TestDescription test)

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

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

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

void testRunEnded(long elapsedTime, runMetrics)

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

void testRunFailed(FailureDescription failure)

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

void testRunFailed(String errorMessage)

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

void testRunStarted(String name, int numTests, int attemptNumber)

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

void testRunStarted(String name, int numTests, int attemptNumber, long startTime)

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

void testSkipped(TestDescription test, SkipReason reason)

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

void testStarted(TestDescription test, long startTime)

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

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

ModuleListener

public ModuleListener (ITestInvocationListener listener, 
                IInvocationContext moduleContext)

יוצר.

פרמטרים
listener ITestInvocationListener

moduleContext IInvocationContext

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

hasLastAttemptFailed

public boolean hasLastAttemptFailed ()

הפונקציה מחזירה אם ניסיון הניסיון האחרון של המאזין נכשל או לא.

החזרות
boolean

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

setAttemptIsolation

public void setAttemptIsolation (CurrentInvocation.IsolationGrade isolation)

מגדיר אם הניסיון ידווח כאירוע בודד או לא.

פרמטרים
isolation CurrentInvocation.IsolationGrade

setCollectTestsOnly

public void setCollectTestsOnly (boolean collectTestsOnly)

ההגדרה קובעת אם אנחנו אוספים רק את הבדיקות או לא.

פרמטרים
collectTestsOnly boolean

setMarkTestsSkipped

public void setMarkTestsSkipped (boolean skip)

האם לסמן את כל תרחישי הבדיקה כמחויבים לדילוג.

פרמטרים
skip boolean

setTestMappingSources

public void setTestMappingSources ( testMappingSources)

מגדיר מקורות למיפוי בדיקות שיוזנו למדדים.

פרמטרים
testMappingSources

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

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

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

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

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

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

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

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

testEnded

public void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

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

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

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

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

testEnded

public void testEnded (TestDescription test, 
                 testMetrics)

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

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

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

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

testFailed

public void testFailed (TestDescription test, 
                FailureDescription failure)

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

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

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

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

testFailed

public void testFailed (TestDescription test, 
                String trace)

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

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

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

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

testIgnored

public void testIgnored (TestDescription test)

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

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

testLog

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

פרמטרים
dataName String

dataType LogDataType

dataStream InputStreamSource

testLogSaved

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

פרמטרים
dataName String

dataType LogDataType

dataStream InputStreamSource

logFile LogFile

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

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

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

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

testRunFailed

public void testRunFailed (FailureDescription failure)

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

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

testRunFailed

public void testRunFailed (String errorMessage)

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

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

testRunStarted

public void testRunStarted (String name, 
                int numTests, 
                int attemptNumber)

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

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

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

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

testRunStarted

public void testRunStarted (String name, 
                int numTests, 
                int attemptNumber, 
                long startTime)

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

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

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

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

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

testSkipped

public void testSkipped (TestDescription test, 
                SkipReason reason)

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

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

reason SkipReason: SkipReason

testStarted

public void testStarted (TestDescription test, 
                long startTime)

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

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

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