TestRunResult
public
class
TestRunResult
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.TestRunResult |
保存單一測試執行的結果。
準確計算測試次數,並追蹤未完成的測試。
這並非執行緒安全!測試* 回呼必須依序呼叫
摘要
常數 | |
|---|---|
String |
ERROR_DIVIDER
|
公用建構函式 | |
|---|---|
TestRunResult()
建立空白的 |
|
公用方法 | |
|---|---|
void
|
addTestResult(TestDescription test, TestResult testResult)
|
|
getCompletedTests()
取得已完成的測試集。 |
long
|
getElapsedTime()
傳回目前執行作業的經過時間。 |
int
|
getExpectedTestCount()
Gets the number of test cases this TestRunResult expects to have. |
|
getFailedTests()
取得失敗的測試集。 |
String
|
getName()
|
int
|
getNumAllFailedTests()
傳回處於失敗狀態的測試總數 (失敗、假設失敗) |
int
|
getNumCompleteTests()
Gets the number of complete tests in this run ie with status != incomplete. |
int
|
getNumTests()
取得這項執行作業中的測試數量。 |
int
|
getNumTestsInState(TestStatus status)
Gets the number of tests in given state for this run. |
int
|
getNumTestsInState(TestResult.TestStatus ddmlibStatus)
為與舊版狀態相容。 |
|
getPassedTests()
取得通過的測試集。 |
FailureDescription
|
getRunFailureDescription()
如果執行作業未失敗,則傳回執行作業失敗描述元 |
String
|
getRunFailureMessage()
如果執行作業未失敗,則傳回執行作業失敗錯誤訊息 |
MultiMap<String, LogFile>
|
getRunLoggedFiles()
傳回地圖副本,其中包含與該測試案例相關聯的所有記錄檔案。 |
|
getRunMetrics()
|
|
getRunProtoMetrics()
|
long
|
getStartTime()
傳回第一次呼叫 testRunStart 的開始時間。 |
|
getTestEntriesInState(
取得指定狀態的測試集。 |
|
getTestResults()
傳回測試結果的地圖。 |
|
getTestsInState(
取得指定狀態的測試集。 |
|
getTestsResultsInState(TestStatus status)
傳回特定狀態的所有 |
String
|
getTextSummary()
傳回描述結果的易讀字串。 |
boolean
|
hasFailedTests()
|
boolean
|
isRunComplete()
|
boolean
|
isRunFailure()
|
static
TestRunResult
|
merge(
|
static
TestRunResult
|
merge(
合併相同 testRunName 的多個 TestRunResults。 |
void
|
resetRunFailure()
重設執行失敗狀態。 |
void
|
setAggregateMetrics(boolean metricAggregation)
|
void
|
setRunComplete(boolean runComplete)
|
void
|
testAssumptionFailure(TestDescription test, String trace)
|
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
|
void
|
testEnded(TestDescription test, long endTime,
|
void
|
testEnded(TestDescription test,
|
void
|
testFailed(TestDescription test, FailureDescription failure)
|
void
|
testFailed(TestDescription test, String trace)
|
void
|
testIgnored(TestDescription test)
|
void
|
testLogSaved(String dataName, LogFile logFile)
系統會儲存記錄的檔案相關資訊,並將其與進行中的測試案例或測試執行作業建立關聯。 |
void
|
testRunEnded(long elapsedTime,
|
void
|
testRunFailed(FailureDescription failureDescription)
|
void
|
testRunFailed(String errorMessage)
|
void
|
testRunStarted(String runName, int testCount, long startTime)
通知測試執行作業已啟動。 |
void
|
testRunStarted(String runName, int testCount)
通知測試執行作業已啟動。 |
void
|
testRunStopped(long elapsedTime)
|
void
|
testSkipped(TestDescription test, SkipReason reason)
|
void
|
testStarted(TestDescription test, long startTime)
|
void
|
testStarted(TestDescription test)
|
常數
ERROR_DIVIDER
public static final String ERROR_DIVIDER
常數值: " ====Next Error==== "
公用建構函式
公用方法
addTestResult
public void addTestResult (TestDescription test, TestResult testResult)
| 參數 | |
|---|---|
test |
TestDescription |
testResult |
TestResult |
getCompletedTests
publicgetCompletedTests ()
取得已完成的測試集。
| 傳回 | |
|---|---|
|
|
getElapsedTime
public long getElapsedTime ()
傳回目前執行作業的經過時間。
| 傳回 | |
|---|---|
long |
|
getExpectedTestCount
public int getExpectedTestCount ()
取得這個 TestRunResult 預期擁有的測試案例數量。由於測試當機,實際數量可能少於預期數量。通常,這類不符情況表示測試執行失敗。
| 傳回 | |
|---|---|
int |
|
getFailedTests
publicgetFailedTests ()
取得失敗的測試集。
| 傳回 | |
|---|---|
|
|
getName
public String getName ()
| 傳回 | |
|---|---|
String |
測試執行作業名稱 |
getNumAllFailedTests
public int getNumAllFailedTests ()
傳回處於失敗狀態的測試總數 (失敗、假設失敗)
| 傳回 | |
|---|---|
int |
|
getNumCompleteTests
public int getNumCompleteTests ()
取得這項執行作業中已完成的測試數量,也就是狀態 != incomplete。
| 傳回 | |
|---|---|
int |
|
getNumTests
public int getNumTests ()
取得這次執行中的測試數量。
| 傳回 | |
|---|---|
int |
|
getNumTestsInState
public int getNumTestsInState (TestStatus status)
取得這項執行作業中處於指定狀態的測試數量。
| 參數 | |
|---|---|
status |
TestStatus |
| 傳回 | |
|---|---|
int |
|
getNumTestsInState
public int getNumTestsInState (TestResult.TestStatus ddmlibStatus)
如要與舊版狀態相容,請改用 getNumTestsInState(com.android.tradefed.result.TestStatus)。
| 參數 | |
|---|---|
ddmlibStatus |
TestResult.TestStatus |
| 傳回 | |
|---|---|
int |
|
getPassedTests
publicgetPassedTests ()
取得通過的測試集。
| 傳回 | |
|---|---|
|
|
getRunFailureDescription
public FailureDescription getRunFailureDescription ()
如果執行作業未失敗,則傳回執行作業失敗描述元 null。
| 傳回 | |
|---|---|
FailureDescription |
|
getRunFailureMessage
public String getRunFailureMessage ()
如果執行作業未失敗,則傳回執行作業失敗錯誤訊息 null。
| 傳回 | |
|---|---|
String |
|
getRunLoggedFiles
public MultiMap<String, LogFile> getRunLoggedFiles ()
傳回地圖副本,其中包含與該測試案例相關聯的所有記錄檔案。
| 傳回 | |
|---|---|
MultiMap<String, LogFile> |
|
getStartTime
public long getStartTime ()
傳回第一次呼叫 testRunStart 的開始時間。
| 傳回 | |
|---|---|
long |
|
getTestEntriesInState
publicgetTestEntriesInState ( statuses)
取得指定狀態的測試集。
| 參數 | |
|---|---|
statuses |
|
| 傳回 | |
|---|---|
|
|
getTestResults
publicgetTestResults ()
傳回測試結果的地圖。
| 傳回 | |
|---|---|
|
|
getTestsInState
publicgetTestsInState ( statuses)
取得指定狀態的測試集。
| 參數 | |
|---|---|
statuses |
|
| 傳回 | |
|---|---|
|
|
getTestsResultsInState
publicgetTestsResultsInState (TestStatus status)
傳回特定狀態的所有 TestResult。
| 參數 | |
|---|---|
status |
TestStatus |
| 傳回 | |
|---|---|
|
|
getTextSummary
public String getTextSummary ()
傳回描述結果的易讀字串。
| 傳回 | |
|---|---|
String |
|
hasFailedTests
public boolean hasFailedTests ()
| 傳回 | |
|---|---|
boolean |
true 如果測試執行有任何失敗或錯誤的測試。 |
isRunComplete
public boolean isRunComplete ()
| 傳回 | |
|---|---|
boolean |
true (如果測試執行作業已完成)。 |
isRunFailure
public boolean isRunFailure ()
| 傳回 | |
|---|---|
boolean |
true (如果測試執行失敗)。 |
合併
public static TestRunResult merge (testRunResults, MergeStrategy strategy)
合併相同 testRunName 的多個 TestRunResults。如果測試案例出現在多個 TestRunResults 中,但結果不同 (例如「boottest-device」執行三次,結果為 FAIL-FAIL-PASS),我們會串連所有失敗執行的堆疊追蹤記錄,並信任最終執行結果的狀態、指標、記錄檔、開始/結束時間。
| 參數 | |
|---|---|
testRunResults |
:要合併的 TestRunResult 清單。 |
strategy |
MergeStrategy:合併結果時採用的合併策略。 |
| 傳回 | |
|---|---|
TestRunResult |
最終的 TestRunResult,其中包含來自 testRunResults 的合併資料。 |
resetRunFailure
public void resetRunFailure ()
重設執行失敗狀態。
有時重試時需要重設執行失敗狀態。請謹慎執行這項操作,以免清除實際發生的故障。
setAggregateMetrics
public void setAggregateMetrics (boolean metricAggregation)
| 參數 | |
|---|---|
metricAggregation |
boolean |
setRunComplete
public void setRunComplete (boolean runComplete)
| 參數 | |
|---|---|
runComplete |
boolean |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
| 參數 | |
|---|---|
test |
TestDescription |
trace |
String |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
| 參數 | |
|---|---|
test |
TestDescription |
failure |
FailureDescription |
testEnded
public void testEnded (TestDescription test, long endTime,testMetrics)
| 參數 | |
|---|---|
test |
TestDescription |
endTime |
long |
testMetrics |
|
testEnded
public void testEnded (TestDescription test,testMetrics)
| 參數 | |
|---|---|
test |
TestDescription |
testMetrics |
|
testFailed
public void testFailed (TestDescription test, FailureDescription failure)
| 參數 | |
|---|---|
test |
TestDescription |
failure |
FailureDescription |
testFailed
public void testFailed (TestDescription test, String trace)
| 參數 | |
|---|---|
test |
TestDescription |
trace |
String |
testLogSaved
public void testLogSaved (String dataName,
LogFile logFile)系統會儲存記錄的檔案相關資訊,並與進行中的測試案例或測試執行作業建立關聯。
| 參數 | |
|---|---|
dataName |
String:參照資料的名稱。 |
logFile |
LogFile:代表物件儲存位置的 LogFile 物件,以及相關資訊。 |
testRunEnded
public void testRunEnded (long elapsedTime,
runMetrics) | 參數 | |
|---|---|
elapsedTime |
long |
runMetrics |
|
testRunFailed
public void testRunFailed (FailureDescription failureDescription)
| 參數 | |
|---|---|
failureDescription |
FailureDescription |
testRunFailed
public void testRunFailed (String errorMessage)
| 參數 | |
|---|---|
errorMessage |
String |
testRunStarted
public void testRunStarted (String runName,
int testCount,
long startTime)通知測試執行作業已啟動。
| 參數 | |
|---|---|
runName |
String:與測試執行作業相關聯的名稱,用於追蹤。 |
testCount |
int:與測試執行作業相關聯的預期測試案例數量。 |
startTime |
long |
testRunStarted
public void testRunStarted (String runName,
int testCount)通知測試執行作業已啟動。
| 參數 | |
|---|---|
runName |
String:與測試執行作業相關聯的名稱,用於追蹤。 |
testCount |
int:與測試執行作業相關聯的預期測試案例數量。 |
testRunStopped
public void testRunStopped (long elapsedTime)
| 參數 | |
|---|---|
elapsedTime |
long |
testSkipped
public void testSkipped (TestDescription test, SkipReason reason)
| 參數 | |
|---|---|
test |
TestDescription |
reason |
SkipReason |
testStarted
public void testStarted (TestDescription test, long startTime)
| 參數 | |
|---|---|
test |
TestDescription |
startTime |
long |