TestTimeoutEnforcer

public final class TestTimeoutEnforcer
extends ResultForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.testtype.TestTimeoutEnforcer


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

חשוב לזכור שהכלי הזה לא יפריע לבדיקות, אבל הוא יגרום לכך שהן ייכשלו.

סיכום

ערכים קבועים

String TEST_CASE_TIMEOUT_DESCRIPTION

String TEST_CASE_TIMEOUT_OPTION

‫constructors ציבוריים

TestTimeoutEnforcer(long perTestCaseTimeout, TimeUnit unit, ITestInvocationListener... listeners)

יוצרים את TestTimeoutEnforcer עם פסק הזמן שצריך לאכוף.

TestTimeoutEnforcer(long perTestCaseTimeout, TimeUnit unit, List<ITestInvocationListener> listeners)

יוצרים את TestTimeoutEnforcer עם פסק הזמן שצריך לאכוף.

‫methods ציבוריים

void testAssumptionFailure(TestDescription test, FailureDescription failure)

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

void testAssumptionFailure(TestDescription test, String trace)

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

void testEnded(TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)

חלופה ל-testEnded(TestDescription,Map) שבה אפשר לציין את שעת הסיום ישירות.

void testFailed(TestDescription test, FailureDescription failure)

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

void testFailed(TestDescription test, String trace)

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

void testIgnored(TestDescription test)

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

void testStarted(TestDescription test, long startTime)

חלופה ל-testStarted(TestDescription) שבה מציינים גם את תאריך ההתחלה של הבדיקה, בשילוב עם testEnded(TestDescription,long,Map) למדידה מדויקת.

ערכים קבועים

TEST_CASE_TIMEOUT_DESCRIPTION

public static final String TEST_CASE_TIMEOUT_DESCRIPTION

ערך קבוע: "The timeout that will be applied to each test case of the run."

TEST_CASE_TIMEOUT_OPTION

public static final String TEST_CASE_TIMEOUT_OPTION

ערך קבוע: "test-case-timeout"

‫constructors ציבוריים

TestTimeoutEnforcer

public TestTimeoutEnforcer (long perTestCaseTimeout, 
                TimeUnit unit, 
                ITestInvocationListener... listeners)

יוצרים את TestTimeoutEnforcer עם פסק הזמן שצריך לאכוף.

פרמטרים
perTestCaseTimeout long: ערך הזמן הקצוב לתפוגה.

unit TimeUnit: הערך TimeUnit של perTestCaseTimeout.

listeners ITestInvocationListener: כתובת ה-ITestInvocationListener שאליה תתבצע ההעברה.

TestTimeoutEnforcer

public TestTimeoutEnforcer (long perTestCaseTimeout, 
                TimeUnit unit, 
                List<ITestInvocationListener> listeners)

יוצרים את TestTimeoutEnforcer עם פסק הזמן שצריך לאכוף.

פרמטרים
perTestCaseTimeout long: ערך הזמן הקצוב לתפוגה.

unit TimeUnit: הערך TimeUnit של perTestCaseTimeout.

listeners List: כתובת ה-ITestInvocationListener שאליה תתבצע ההעברה.

‫methods ציבוריים

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

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

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

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

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

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

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

trace String: דוח קריסות של הכשל

testEnded

public void testEnded (TestDescription test, 
                long endTime, 
                HashMap<String, MetricMeasurement.Metric> testMetrics)

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

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

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

testMetrics HashMap: 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: מזהה את הבדיקה

testStarted

public void testStarted (TestDescription test, 
                long startTime)

חלופה ל-testStarted(TestDescription) שבה מציינים גם את תאריך ההתחלה של הבדיקה, בשילוב עם testEnded(TestDescription,long,Map) למדידה מדויקת.

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

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