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(long perTestCaseTimeout, TimeUnit unit,
יוצרים את |
|
methods ציבוריים | |
|---|---|
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
ערך קבוע: "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: הערך ERROR(/TimeUnit) של perTestCaseTimeout. |
listeners |
ITestInvocationListener: כתובת ה-ITestInvocationListener שאליה תתבצע ההעברה. |
TestTimeoutEnforcer
public TestTimeoutEnforcer (long perTestCaseTimeout,
TimeUnit unit,
listeners) יוצרים את TestTimeoutEnforcer עם פסק הזמן שצריך לאכוף.
| פרמטרים | |
|---|---|
perTestCaseTimeout |
long: ערך הזמן הקצוב לתפוגה. |
unit |
TimeUnit: הערך ERROR(/TimeUnit) של perTestCaseTimeout. |
listeners |
: כתובת ה-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,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() |