ITestLifeCycleReceiver
public interface ITestLifeCycleReceiver
com.android.tradefed.result.ITestLifeCycleReceiver |
מקבל התראות על אירועים במהלך ריצות בדיקת מכשור.
תבנית לאחר org.junit.runner.notification.RunListener
רצף השיחות יהיה:
- testRunStarted
- הבדיקה התחילה
- [מבחן נכשל]
- [testAssumption Failure]
- [התעלם מהבדיקה]
- הבדיקה הסתיים
- ....
- [testRunFailed]
- testRunEnded
סיכום
שיטות ציבוריות | |
---|---|
default void | testAssumptionFailure ( TestDescription test, String trace) נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי |
default void | testAssumptionFailure ( TestDescription test, FailureDescription failure) נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי |
default void | testEnded ( TestDescription test, long endTime, testMetrics) testEnded ( TestDescription test, long endTime, testMetrics) חלופה ל- |
default void | testEnded ( TestDescription test, testMetrics) testEnded ( TestDescription test, testMetrics) מדווח על סיום הביצוע של מקרה בדיקה בודד. |
default void | testFailed ( TestDescription test, FailureDescription failure) מדווח על כישלון של מקרה בדיקה בודד. |
default void | testFailed ( TestDescription test, String trace) מדווח על כישלון של מקרה בדיקה בודד. |
default void | testIgnored ( TestDescription test) נקרא כאשר בדיקה לא תופעל, בדרך כלל מכיוון ששיטת בדיקה מסומנת ב-org.junit.Ignore. |
default void | testRunEnded (long elapsedTimeMillis, runMetrics) testRunEnded (long elapsedTimeMillis, runMetrics) מדווח על סיום ריצת המבחן. |
default void | testRunFailed ( FailureDescription failure) ריצת בדיקת הדוחות לא הושלמה עקב כשל המתואר על ידי |
default void | testRunFailed (String errorMessage) ריצת בדיקת הדוחות לא הושלמה עקב שגיאה קטלנית. |
default void | testRunStarted (String runName, int testCount, int attemptNumber) מדווח על תחילת ריצת מבחן. |
default void | testRunStarted (String runName, int testCount) מדווח על תחילת ריצת מבחן. |
default void | testRunStarted (String runName, int testCount, int attemptNumber, long startTime) מדווח על תחילת ריצת מבחן. |
default void | testRunStopped (long elapsedTime) הפעלת בדיקת הדוחות הופסקה לפני השלמתה עקב בקשת משתמש. |
default void | testSkipped ( TestDescription test, SkipReason reason) נקרא כאשר מדלגים על בדיקה ולא בוצעה מסיבה שאינה צפויה בדרך כלל. |
default void | testStarted ( TestDescription test, long startTime) חלופה ל- |
default void | testStarted ( TestDescription test) מדווח על תחילת מקרה בדיקה בודד. |
שיטות ציבוריות
testAssumption Failure
public void testAssumptionFailure (TestDescription test, String trace)
נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
trace | String : עקבות מחסנית של כישלון |
testAssumption Failure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
נקרא כאשר בדיקה אטומית מסמנת שהיא מניחה מצב שהוא שקרי
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
failure | FailureDescription : FailureDescription המתאר את הכישלון ואת ההקשר שלו. |
הבדיקה הסתיים
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) של המדדים הנפלטים |
הבדיקה הסתיים
public void testEnded (TestDescription test,testMetrics)
מדווח על סיום הביצוע של מקרה בדיקה בודד.
אם testFailed(TestDescription, FailureDescription)
לא הופעל, מבחן זה עבר. מחזירה גם מדדי מפתח/ערך שייתכן שנפלטו במהלך ביצוע מקרה הבדיקה.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
testMetrics | ERROR(/Map) של המדדים הנפלטים |
מבחן נכשל
public void testFailed (TestDescription test, FailureDescription failure)
מדווח על כישלון של מקרה בדיקה בודד.
ייקרא בין testStarted לבין testEnded.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
failure | FailureDescription : FailureDescription המתאר את הכישלון ואת ההקשר שלו. |
מבחן נכשל
public void testFailed (TestDescription test, String trace)
מדווח על כישלון של מקרה בדיקה בודד.
ייקרא בין testStarted לבין testEnded.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
trace | String : עקבות מחסנית של כישלון |
התעלמו מהבדיקה
public void testIgnored (TestDescription test)
נקרא כאשר בדיקה לא תופעל, בדרך כלל מכיוון ששיטת בדיקה מסומנת ב-org.junit.Ignore.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
testRunEnded
public void testRunEnded (long elapsedTimeMillis,runMetrics)
מדווח על סיום ריצת המבחן. FIXME: אין לנו שני ממשקי Map<> עם סוג שונה, אז עלינו להשתמש ב-HashMap כאן.
פרמטרים | |
---|---|
elapsedTimeMillis | long : המכשיר דיווח על זמן שחלף, באלפיות שניות |
runMetrics | Metric . |
testRunFailed
public void testRunFailed (FailureDescription failure)
ריצת בדיקת הדוחות לא הושלמה עקב כשל המתואר על ידי FailureDescription
.
פרמטרים | |
---|---|
failure | FailureDescription : FailureDescription המתאר את הכישלון ואת ההקשר שלו. |
testRunFailed
public void testRunFailed (String errorMessage)
ריצת בדיקת הדוחות לא הושלמה עקב שגיאה קטלנית.
פרמטרים | |
---|---|
errorMessage | 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 elapsedTime)
הפעלת בדיקת הדוחות הופסקה לפני השלמתה עקב בקשת משתמש.
מטלה: לא בשימוש כרגע, שקול להסיר
פרמטרים | |
---|---|
elapsedTime | long : המכשיר דיווח על זמן שחלף, באלפיות שניות |
דילוג על הבדיקה
public void testSkipped (TestDescription test, SkipReason reason)
נקרא כאשר מדלגים על בדיקה ולא בוצעה מסיבה שאינה צפויה בדרך כלל. בדיקות אלו ינוסו לנסות שוב כדי לנסות לבצע ביצוע תקין.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |
reason | SkipReason : SkipReason |
הבדיקה התחילה
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() |
הבדיקה התחילה
public void testStarted (TestDescription test)
מדווח על תחילת מקרה בדיקה בודד. ממשק ישן יותר, צריך להשתמש testStarted(com.android.tradefed.result.TestDescription)
במידת האפשר.
פרמטרים | |
---|---|
test | TestDescription : מזהה את הבדיקה |