測試失敗監聽器

public class TestFailureListener
extends Object implements ITestInvocationListener

java.lang.Object
com.android.tradefed.testtype.suite.TestFailureListener


偵聽器用於在測試失敗時根據請求採取操作,例如螢幕截圖、錯誤報告、logcat 收集。

概括

公共構造函數

TestFailureListener ( devices, boolean bugReportOnFailure, boolean rebootOnFailure) TestFailureListener ( devices, boolean bugReportOnFailure, boolean rebootOnFailure)

公共方法

void applyModuleConfiguration (boolean bugreportOnFailure)

允許透過模組特定配置覆蓋失敗時捕獲的呼叫設定。

void join ()

加入所有 logcat 捕獲線程以確保它們終止。

void setLogger (ITestLogger logger)

設定日誌的儲存位置。

void testFailed (TestDescription test, String trace)

void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
void testLogForward (String dataName, LogDataType dataType, InputStreamSource dataStream)

將日誌轉送至記錄器,不要從 #testLog 回呼中執行此操作,就好像 TestFailureListener 是鏈的一部分一樣,這將導致無限循環。

公共構造函數

測試失敗監聽器

public TestFailureListener ( devices, 
                boolean bugReportOnFailure, 
                boolean rebootOnFailure)

參數
devices

bugReportOnFailure boolean

rebootOnFailure boolean

公共方法

應用模組配置

public void applyModuleConfiguration (boolean bugreportOnFailure)

允許透過模組特定配置覆蓋失敗時捕獲的呼叫設定。

參數
bugreportOnFailure boolean : true 捕獲測試失敗的錯誤報告。否則為假。

加入

public void join ()

加入所有 logcat 捕獲線程以確保它們終止。

設定記錄器

public void setLogger (ITestLogger logger)

設定日誌的儲存位置。

參數
logger ITestLogger

測試失敗

public void testFailed (TestDescription test, 
                String trace)

參數
test TestDescription

trace String

測試日誌

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

參數
dataName String

dataType LogDataType

dataStream InputStreamSource

測試日誌轉發

public void testLogForward (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

將日誌轉送至記錄器,不要從 #testLog 回呼中執行此操作,就好像 TestFailureListener 是鏈的一部分一樣,這將導致無限循環。

參數
dataName String

dataType LogDataType

dataStream InputStreamSource