ResultReporter

public class ResultReporter
extends Object implements IConfigurationReceiver, ILogSaverListener, ISupportGranularResults, ITestSummaryListener

java.lang.Object
   ↳ com.google.android.tradefed.result.teststorage.ResultReporter


摘要

巢狀類別

class ResultReporter.ListBuilder<T>

 

常數

String DEFAULT_BUILDPROVIDER

String EXPERIMENTAL

String SYSTEM_CHECKER

String TRADEFED

公用建構函式

ResultReporter()

公用方法

void enableFilterProperty(boolean enableFilterProperty)
IConfiguration getConfiguration()
TestSummary getSummary()

允許 InvocationListener 傳回摘要。

void invocationEnded(long elapsedTime)

回報是否因成功或發生錯誤而終止呼叫。

void invocationFailed(FailureDescription failure)

Reports an incomplete invocation due to some error condition.

void invocationFailed(Throwable cause)

Reports an incomplete invocation due to some error condition.

void invocationSkipped(SkipReason reason)

將叫用作業回報為已略過

void invocationStarted(IInvocationContext context)

回報測試呼叫的開始時間。

void logAssociation(String dataName, LogFile log)

在某些情況下,記錄必須與測試案例密切相關,但無法在直接 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile) 回呼中執行此操作。

void putEarlySummary( summaries)

傳遞非空值的 TestSummary ERROR(/List),這些 TestSummary 可能已從任何 ITestInvocationListener 傳回,並在設定中例項化。

void setConfiguration(IConfiguration configuration)

注入使用的 IConfiguration

void setLogSaver(ILogSaver logSaver)

設定 ILogSaver,允許實作者儲存檔案。

boolean supportGranularResults()

如果檢舉者支援精細結果,則傳回 True,否則傳回 False。

void testAssumptionFailure(TestDescription test, String trace)

當原子測試標記假設條件為 false 時,系統會呼叫這個函式。

void testAssumptionFailure(TestDescription test, FailureDescription failure)

當原子測試標記假設條件為 false 時,系統會呼叫這個函式。

void testEnded(TestDescription test, long endTime, testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) 的替代方案,可直接指定結束時間。

void testEnded(TestDescription test, metrics)

回報個別測試案例的執行結束時間。

void testFailed(TestDescription test, FailureDescription failure)

回報個別測試案例的失敗情形。

void testFailed(TestDescription test, String trace)

回報個別測試案例的失敗情形。

void testIgnored(TestDescription test)

Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.

void testModuleEnded()

回報模組執行作業的結束時間。

void testModuleStarted(IInvocationContext moduleContext)

回報模組的執行開始時間。

void testRunEnded(long elapsedTimeMillis, runMetrics)

Reports end of test run.

void testRunFailed(FailureDescription failure)

由於 FailureDescription 所述的失敗情形,報表測試執行作業無法完成。

void testRunFailed(String errorMessage)

由於發生嚴重錯誤,報表測試執行作業無法完成。

void testRunStarted(String runName, int testCount, int attemptNumber)

回報測試執行的開始時間。

void testRunStarted(String runName, int testCount)

回報測試執行的開始時間。

void testRunStarted(String runName, int testCount, int attemptNumber, long startTime)

回報測試執行的開始時間。

void testSkipped(TestDescription test, SkipReason reason)

Called when a test is skipped and did not execute for a reason that is not usually expected.

void testStarted(TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription) 的替代方案,我們也會指定測試開始時間,並搭配 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 進行準確的評估。

void testStarted(TestDescription test)

回報個別測試案例的開始時間。

受保護的方法

ITestStorageClient createTestStorageClient(IInvocationContext context)
String getVersion()

常數

DEFAULT_BUILDPROVIDER

public static final String DEFAULT_BUILDPROVIDER

常數值: "androidbuild"

實驗類

public static final String EXPERIMENTAL

常數值: "experimental"

SYSTEM_CHECKER

public static final String SYSTEM_CHECKER

常數值: "system_checker"

Tradefed

public static final String TRADEFED

常數值: "tradefed"

公用建構函式

ResultReporter

public ResultReporter ()

公用方法

enableFilterProperty

public void enableFilterProperty (boolean enableFilterProperty)

參數
enableFilterProperty boolean

getConfiguration

public IConfiguration getConfiguration ()

傳回
IConfiguration

getSummary

public TestSummary getSummary ()

允許 InvocationListener 傳回摘要。

傳回
TestSummary 匯總執行作業的 TestSummary,或空值

invocationEnded

public void invocationEnded (long elapsedTime)

回報是否因某些錯誤狀況而終止呼叫 (無論是否成功)。

TradeFederation 架構會自動呼叫。

參數
elapsedTime long:以毫秒為單位的呼叫經過時間

invocationFailed

public void invocationFailed (FailureDescription failure)

Reports an incomplete invocation due to some error condition.

TradeFederation 架構會自動呼叫。

參數
failure FailureDescription:說明失敗原因的 FailureDescription

invocationFailed

public void invocationFailed (Throwable cause)

由於發生錯誤狀況,因此回報不完整的叫用。

TradeFederation 架構會自動呼叫。

參數
cause ThrowableThrowable 失敗的 Throwable 原因

invocationSkipped

public void invocationSkipped (SkipReason reason)

將叫用作業回報為已略過

參數
reason SkipReason

invocationStarted

public void invocationStarted (IInvocationContext context)

回報測試呼叫的開始時間。

TradeFederation 架構會自動呼叫這個方法。檢舉者需要覆寫這個方法,才能支援多部裝置回報。

參數
context IInvocationContext:叫用相關資訊

logAssociation

public void logAssociation (String dataName, 
                LogFile log)

在某些情況下,記錄必須與測試案例緊密相關,但無法在直接 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile) 回呼中執行此操作。因此,這個回呼可明確提供強關聯。

參數
dataName String:資料名稱

log LogFile:先前記錄的 LogFile,應與測試案例建立關聯。

putEarlySummary

public void putEarlySummary ( summaries)

傳遞非空值的 TestSummary ERROR(/List),這些 TestSummary 可能已從任何 ITestInvocationListener 傳回,並在設定中例項化。系統會在 ITestInvocationListener.invocationStarted(com.android.tradefed.invoker.IInvocationContext) 後生成初步摘要,並在呼叫結束時透過 ERROR(/#putSummary(List)) 完成摘要。

這個方法會在 ITestInvocationListener.invocationStarted(com.android.tradefed.invoker.IInvocationContext) 之前呼叫,並包含先前設定的接聽程式中的所有摘要。

參數
summaries :來自目前設定的 ITestInvocationListener 的非空值 TestSummary ERROR(/List)

setConfiguration

public void setConfiguration (IConfiguration configuration)

插入使用的 IConfiguration

參數
configuration IConfiguration

setLogSaver

public void setLogSaver (ILogSaver logSaver)

設定 ILogSaver,允許實作者儲存檔案。

參數
logSaver ILogSaverILogSaver

supportGranularResults

public boolean supportGranularResults ()

如果檢舉者支援精細結果,則傳回 True,否則傳回 False。

傳回
boolean

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

當原子測試標記假設為 false 的條件時呼叫

參數
test TestDescription:識別測試

trace String:失敗的堆疊追蹤

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

當原子測試標記假設為 false 的條件時呼叫

參數
test TestDescription:識別測試

failure FailureDescriptionFailureDescription,說明失敗情形和相關情境。

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)

testEnded

public void testEnded (TestDescription test, 
                 metrics)

回報個別測試案例的執行結束時間。

如果未叫用 testFailed(TestDescription, FailureDescription),這項測試就會通過。也會傳回在測試案例執行期間可能發出的任何鍵/值指標。

參數
test TestDescription:識別測試

metrics :發出的指標 ERROR(/Map)

testFailed

public void testFailed (TestDescription test, 
                FailureDescription failure)

回報個別測試案例的失敗情形。

會在 testStarted 和 testEnded 之間呼叫。

參數
test TestDescription:識別測試

failure FailureDescriptionFailureDescription,說明失敗情形和相關情境。

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:識別測試

testModuleEnded

public void testModuleEnded ()

回報模組執行作業的結束時間。

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

回報模組的執行開始時間。這個回呼與 testModuleEnded() 相關聯,且在序列中為選用項目。只有在使用模組的執行期間,才會使用這個標記:以套件為基礎的執行器。

參數
moduleContext IInvocationContext:模組的 IInvocationContext

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

報告測試執行結束時間。

參數
elapsedTimeMillis long:裝置回報的經過時間 (以毫秒為單位)

runMetrics :在測試執行結束時回報的鍵/值組合

testRunFailed

public void testRunFailed (FailureDescription failure)

由於 FailureDescription 所述的失敗情形,報表測試執行作業無法完成。

參數
failure FailureDescriptionFailureDescription,說明失敗情形和相關情境。

testRunFailed

public void testRunFailed (String errorMessage)

發生嚴重錯誤,導致報表測試執行作業無法完成。

參數
errorMessage StringString,說明執行失敗的原因。

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber)

回報測試執行的開始時間。

參數
runName String:測試執行作業名稱

testCount int:測試執行作業中的測試總數

attemptNumber int:訂單號碼,用於識別相同 runName 的不同嘗試,該 runName 會多次執行。attemptNumber 是以 0 為索引,每次執行新作業時都應遞增。舉例來說,如果測試細部重試 3 次,則在相同 runName 下應有 4 次執行作業,且 attemptNumber 為 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 的不同嘗試,該 runName 會多次執行。attemptNumber 是以 0 為索引,每次執行新作業時都應遞增。舉例來說,如果測試細部重試 3 次,則在相同 runName 下應有 4 次執行作業,且 attemptNumber 為 0 到 3。

startTime long:跑步開始時間,透過 System.currentTimeMillis() 測量

testSkipped

public void testSkipped (TestDescription test, 
                SkipReason reason)

Called when a test is skipped and did not execute for a reason that is not usually expected. 系統會嘗試重試這些測試,以確保正常執行。

參數
test TestDescription:識別測試

reason SkipReasonSkipReason

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() 測量

testStarted

public void testStarted (TestDescription test)

回報個別測試案例的開始時間。舊版介面,建議盡可能使用 testStarted(com.android.tradefed.result.TestDescription)

參數
test TestDescription:識別測試

受保護的方法

createTestStorageClient

protected ITestStorageClient createTestStorageClient (IInvocationContext context)

參數
context IInvocationContext

傳回
ITestStorageClient

getVersion

protected String getVersion ()

傳回
String