Google cam kết thúc đẩy công bằng chủng tộc cho Cộng đồng người da đen. Xem cách thực hiện.

GranularRetriableTestWrapper

public class GranularRetriableTestWrapper
extends Object implements IRemoteTest , ITestCollector

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


Lớp trình bao bọc hoạt động trên IRemoteTest để tạo hạt IRemoteTest ở cấp độ trường hợp thử nghiệm. Một IRemoteTest có thể chứa nhiều testcase. Trước đây, các trường hợp thử nghiệm này được xử lý như một tổng thể: Khi IRemoteTest chạy, tất cả các trường hợp thử nghiệm sẽ chạy. Một số IRemoteTest (Những cái triển khai ITestFilterReceiver) có thể chấp nhận danh sách các trường hợp thử nghiệm cho phép và chỉ chạy các trường hợp thử nghiệm đó. Lớp này tận dụng tính năng hiện có và cung cấp một cách linh hoạt hơn để chạy bộ thử nghiệm.

  • Có thể thử lại một trường hợp thử nghiệm nhiều lần (trong cùng một lần chạy IRemoteTest) để giảm tỷ lệ lỗi không do lỗi thử nghiệm.
  • Các trường hợp thử nghiệm đã thử lại được thu thập động từ các lần chạy không thành công trước đó.

Ghi chú:

  • Điều kiện tiên quyết để chạy một tập hợp con các trường hợp thử nghiệm là loại thử nghiệm phải triển khai giao diện ITestFilterReceiver .
  • X là số lần thử lại tối đa tùy chỉnh.

Bản tóm tắt

các lớp lồng nhau

class GranularRetriableTestWrapper.StartEndCollector

Trình trợ giúp lớp để bắt đầu và kết thúc chạy bị thiếu.

nhà thầu công cộng

GranularRetriableTestWrapper ( IRemoteTest test, ITestInvocationListener mainListener, TestFailureListener failureListener, moduleLevelListeners, int maxRunLimit) GranularRetriableTestWrapper ( IRemoteTest test, ITestInvocationListener mainListener, TestFailureListener failureListener, moduleLevelListeners, int maxRunLimit)
GranularRetriableTestWrapper ( IRemoteTest test, ModuleDefinition module, ITestInvocationListener mainListener, TestFailureListener failureListener, moduleLevelListeners, int maxRunLimit) GranularRetriableTestWrapper ( IRemoteTest test, ModuleDefinition module, ITestInvocationListener mainListener, TestFailureListener failureListener, moduleLevelListeners, int maxRunLimit)

Phương thức công khai

final int getExpectedTestsCount ()

Tính số lượng testcase trong IRemoteTest .

final getFinalTestRunResults ()

Nhận TestRunResults đã hợp nhất từ ​​mỗi lần chạy IRemoteTest .

final getPassedTests ()
ModuleListener getResultListener ()

Trả về người nghe có chứa tất cả các kết quả.

int getRetryCount ()
void run ( TestInformation testInfo, ITestInvocationListener listener)

Lên lịch một loạt IRemoteTest#run(TestInformation, ITestInvocationListener) .

void setCollectTestsOnly (boolean shouldCollectTest)

Bật hoặc tắt chế độ thu bài kiểm tra

void setInvocationContext ( IInvocationContext moduleInvocationContext)

Đặt IInvocationContext làm thuộc tính GranularRetriableTestWrapper .

void setLogSaver ( ILogSaver logSaver)

Đặt ILogSaver của Mô-đun làm thuộc tính GranularRetriableTestWrapper .

void setMarkTestsSkipped (boolean skipTestCases)

Đặt ModuleDefinition RunStrategy làm thuộc tính GranularRetriableTestWrapper .

void setMetricCollectors ( runMetricCollectors) setMetricCollectors ( runMetricCollectors)

Đặt runMetricCollector của ModuleDefinition làm thuộc tính GranularRetriableTestWrapper .

void setModuleConfig ( IConfiguration moduleConfiguration)

Đặt ModuleDefinition 's ModuleConfig làm thuộc tính GranularRetriableTestWrapper .

void setModuleId (String moduleId)

Đặt tên ModuleDefinition làm thuộc tính GranularRetriableTestWrapper .

void setRetryDecision ( IRetryDecision decision)

Đặt IRetryDecision sẽ được sử dụng.

nhà thầu công cộng

GranularRetriableTestWrapper

public GranularRetriableTestWrapper (IRemoteTest test, 
                ITestInvocationListener mainListener, 
                TestFailureListener failureListener, 
                 moduleLevelListeners, 
                int maxRunLimit)

Thông số
test IRemoteTest

mainListener ITestInvocationListener

failureListener TestFailureListener

moduleLevelListeners

maxRunLimit int

GranularRetriableTestWrapper

public GranularRetriableTestWrapper (IRemoteTest test, 
                ModuleDefinition module, 
                ITestInvocationListener mainListener, 
                TestFailureListener failureListener, 
                 moduleLevelListeners, 
                int maxRunLimit)

Thông số
test IRemoteTest

module ModuleDefinition

mainListener ITestInvocationListener

failureListener TestFailureListener

moduleLevelListeners

maxRunLimit int

Phương thức công khai

getExpectedTestsCount

public final int getExpectedTestsCount ()

Tính số lượng testcase trong IRemoteTest . Giá trị này phân biệt các trường hợp thử nghiệm giống nhau được lên lịch lại nhiều lần.

trả lại
int

getFinalTestRunResults

public final  getFinalTestRunResults ()

Nhận TestRunResults đã hợp nhất từ ​​mỗi lần chạy IRemoteTest .

trả lại

getPassedTests

public final  getPassedTests ()

trả lại

getResultListener

public ModuleListener getResultListener ()

Trả về người nghe có chứa tất cả các kết quả.

trả lại
ModuleListener

getRetryCount

public int getRetryCount ()

trả lại
int

chạy

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

Lên lịch một loạt IRemoteTest#run(TestInformation, ITestInvocationListener) .

Thông số
testInfo TestInformation : Đối tượng TestInformation chứa thông tin hữu ích để chạy thử nghiệm.

listener ITestInvocationListener : Trình nghe ResultForwarder chứa một moduleListener mới cho mỗi lần chạy.

ném
DeviceNotAvailableException

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Bật hoặc tắt chế độ thu bài kiểm tra

setInvocationContext

public void setInvocationContext (IInvocationContext moduleInvocationContext)

Đặt IInvocationContext làm thuộc tính GranularRetriableTestWrapper .

Thông số
moduleInvocationContext IInvocationContext : Trình bao bọc sử dụng InvocationContext để khởi tạo MetricCollector khi cần thiết.

setLogSaver

public void setLogSaver (ILogSaver logSaver)

Đặt ILogSaver của Mô-đun làm thuộc tính GranularRetriableTestWrapper .

Thông số
logSaver ILogSaver : Trình nghe cho mỗi lần chạy thử sẽ lưu nhật ký.

setMarkTestsSkiped

public void setMarkTestsSkipped (boolean skipTestCases)

Đặt ModuleDefinition RunStrategy làm thuộc tính GranularRetriableTestWrapper .

Thông số
skipTestCases boolean : có nên bỏ qua các testcase hay không.

setMetricCollector

public void setMetricCollectors ( runMetricCollectors)

Đặt runMetricCollector của ModuleDefinition làm thuộc tính GranularRetriableTestWrapper .

Thông số
runMetricCollectors : Danh sách MetricCollector cho mô-đun.

setModuleConfig

public void setModuleConfig (IConfiguration moduleConfiguration)

Đặt ModuleDefinition 's ModuleConfig làm thuộc tính GranularRetriableTestWrapper .

Thông số
moduleConfiguration IConfiguration : Cung cấp các số liệu mô-đun.

setModuleId

public void setModuleId (String moduleId)

Đặt tên ModuleDefinition làm thuộc tính GranularRetriableTestWrapper .

Thông số
moduleId String : tên của moduleDefinition.

setRetryQuyết định

public void setRetryDecision (IRetryDecision decision)

Đặt IRetryDecision sẽ được sử dụng.

Thông số
decision IRetryDecision