TestTimeoutEnforcer
public
final
class
TestTimeoutEnforcer
extends ResultForwarder
java.lang.Object | ||
↳ | com.android.tradefed.result.ResultForwarder | |
↳ | com.android.tradefed.testtype.TestTimeoutEnforcer |
מאזינים שמאפשרים לבדוק את זמן הביצוע של מקרה בדיקה נתון ולפסול אותו אם הוא חורג מזמן קצוב מראש.
חשוב לזכור שהאכפייה הזו לא משבשת את הבדיקות, אבל היא גורמת להן להיכשל.
סיכום
שדות | |
---|---|
public
static
final
String |
TEST_CASE_TIMEOUT_DESCRIPTION
|
public
static
final
String |
TEST_CASE_TIMEOUT_OPTION
|
קונסטרוקטורים גלויים לכולם | |
---|---|
TestTimeoutEnforcer(long perTestCaseTimeout, TimeUnit unit, ITestInvocationListener... listeners)
יוצרים את |
|
TestTimeoutEnforcer(long perTestCaseTimeout, TimeUnit unit,
יוצרים את |
שיטות ציבוריות | |
---|---|
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
הקריאה מתבצעת כשבדיקה אטומית מסמנת שהיא מניחה תנאי שהוא שקר |
void
|
testAssumptionFailure(TestDescription test, String trace)
הקריאה מתבצעת כשבדיקה אטומית מסמנת שהיא מניחה תנאי שהוא שקר |
void
|
testEnded(TestDescription test, long endTime,
חלופה ל- |
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)
חלופה ל- |
שדות
TEST_CASE_TIMEOUT_DESCRIPTION
public static final String TEST_CASE_TIMEOUT_DESCRIPTION
TEST_CASE_TIMEOUT_OPTION
public static final String TEST_CASE_TIMEOUT_OPTION
קונסטרוקטורים גלויים לכולם
TestTimeoutEnforcer
public TestTimeoutEnforcer (long perTestCaseTimeout, TimeUnit unit, ITestInvocationListener... listeners)
יוצרים את TestTimeoutEnforcer
עם הזמן הקצוב לתפוגה כדי לאכוף אותו.
פרמטרים | |
---|---|
perTestCaseTimeout |
long : הערך של הזמן הקצוב לתפוגה. |
unit |
TimeUnit : הערך של ERROR(/TimeUnit) ב-perTestCaseTimeout. |
listeners |
ITestInvocationListener : ה-ITestInvocationListener להעברה אליו. |
TestTimeoutEnforcer
public TestTimeoutEnforcer (long perTestCaseTimeout, TimeUnit unit,listeners)
יוצרים את TestTimeoutEnforcer
עם הזמן הקצוב לתפוגה כדי לאכוף אותו.
פרמטרים | |
---|---|
perTestCaseTimeout |
long : הערך של הזמן הקצוב לתפוגה. |
unit |
TimeUnit : הערך של ERROR(/TimeUnit) ב-perTestCaseTimeout. |
listeners |
: ה-ITestInvocationListener להעברה אליו. |
שיטות ציבוריות
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,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) של המדדים שמונפקים |
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(com.android.tradefed.result.TestDescription)
שבה מציינים גם את מועד ההתחלה של הבדיקה, בשילוב עם ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))
למדידה מדויקת.
פרמטרים | |
---|---|
test |
TestDescription : מזהה את הבדיקה |
startTime |
long : השעה שבה הבדיקה התחילה, נמדדת באמצעות System.currentTimeMillis() |