GranularRetriableTestWrapper

public class GranularRetriableTestWrapper
extends Object implements IRemoteTest, ITestCollector

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


Một lớp trình bao bọc hoạt động trên IRemoteTest để phân tách IRemoteTest ở cấp độ trường hợp kiểm thử. IRemoteTest có thể chứa nhiều trường hợp kiểm thử. Trước đây, các trường hợp kiểm thử này được coi là một tổng thể: Khi IRemoteTest chạy, tất cả các trường hợp kiểm thử sẽ chạy. Một số IRemoteTest (Những IRemoteTest triển khai ITestFilterReceiver) có thể chấp nhận danh sách cho phép các trường hợp kiểm thử và chỉ chạy những trường hợp kiểm thử đó. 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ộ kiểm thử.

  • Một trường hợp kiểm thử có thể được thử lại nhiều lần (trong cùng một lần chạy IRemoteTest) để giảm tỷ lệ thất bại không phải do lỗi kiểm thử.
  • Các trường hợp kiểm thử được thử lại sẽ được thu thập linh động từ các lỗi chạy trước đó.

Lưu ý:

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

Tóm tắt

Lớp lồng ghép

class GranularRetriableTestWrapper.StartEndCollector

Trợ lý lớp học để phát hiện thời điểm bắt đầu và kết thúc chạy bị thiếu. 

Hàm khởi tạo công khai

GranularRetriableTestWrapper(IRemoteTest test, ITestInvocationListener mainListener, int maxRunLimit)
GranularRetriableTestWrapper(IRemoteTest test, ModuleDefinition module, ITestInvocationListener mainListener, int maxRunLimit)
GranularRetriableTestWrapper(IRemoteTest test, ModuleDefinition module, ITestInvocationListener mainListener, int maxRunLimit, boolean useModuleResultsForwarder, boolean removeModuleBuffering, int targetPreparerRetryCount)

Phương thức công khai

void backfillMissingEvents(ITestInvocationListener listener, FailureDescription failure)
final int getExpectedTestsCount()

Tính số lượng trường hợp kiểm thử 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ề trình nghe chứa tất cả kết quả.

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

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

void setCollectTestsOnly(boolean shouldCollectTest)

Bật hoặc tắt chế độ thu thập dữ liệu thử nghiệm

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)

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

void setModuleConfig(IConfiguration moduleConfiguration)

Đặt ModuleConfig của ModuleDefinition 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 dùng.

Hàm khởi tạo công khai

GranularRetriableTestWrapper

public GranularRetriableTestWrapper (IRemoteTest test, 
                ITestInvocationListener mainListener, 
                int maxRunLimit)

Tham số
test IRemoteTest

mainListener ITestInvocationListener

maxRunLimit int

GranularRetriableTestWrapper

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

Tham số
test IRemoteTest

module ModuleDefinition

mainListener ITestInvocationListener

maxRunLimit int

GranularRetriableTestWrapper

public GranularRetriableTestWrapper (IRemoteTest test, 
                ModuleDefinition module, 
                ITestInvocationListener mainListener, 
                int maxRunLimit, 
                boolean useModuleResultsForwarder, 
                boolean removeModuleBuffering, 
                int targetPreparerRetryCount)

Tham số
test IRemoteTest

module ModuleDefinition

mainListener ITestInvocationListener

maxRunLimit int

useModuleResultsForwarder boolean

removeModuleBuffering boolean

targetPreparerRetryCount int

Phương thức công khai

backfillMissingEvents

public void backfillMissingEvents (ITestInvocationListener listener, 
                FailureDescription failure)

Tham số
listener ITestInvocationListener

failure FailureDescription

getExpectedTestsCount

public final int getExpectedTestsCount ()

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

Giá trị trả về
int

getFinalTestRunResults

public final  getFinalTestRunResults ()

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

Giá trị trả về

getPassedTests

public final  getPassedTests ()

Giá trị trả về

getResultListener

public ModuleListener getResultListener ()

Trả về trình nghe chứa tất cả kết quả.

Giá trị trả về
ModuleListener

getRetryCount

public int getRetryCount ()

Giá trị trả về
int

chạy

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

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

Tham số
testInfo TestInformation: Đối tượng TestInformation chứa thông tin hữu ích để chạy các bài kiểm thử.

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

Gửi
DeviceNotAvailableException

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Bật hoặc tắt chế độ thu thập dữ liệu thử nghiệm

setInvocationContext

public void setInvocationContext (IInvocationContext moduleInvocationContext)

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

Tham số
moduleInvocationContext IInvocationContext: Trình bao bọc sử dụng InvocationContext để khởi chạy 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.

Tham số
logSaver ILogSaver: Các trình nghe cho mỗi lần chạy kiểm thử sẽ lưu nhật ký.

setMarkTestsSkipped

public void setMarkTestsSkipped (boolean skipTestCases)

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

Tham số
skipTestCases boolean: liệu có nên bỏ qua các trường hợp kiểm thử hay không.

setMetricCollectors

public void setMetricCollectors ( runMetricCollectors)

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

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

setModuleConfig

public void setModuleConfig (IConfiguration moduleConfiguration)

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

Tham số
moduleConfiguration IConfiguration: Cung cấp các chỉ số về mô-đun.

setModuleId

public void setModuleId (String moduleId)

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

Tham số
moduleId String: tên của moduleDefinition.

setRetryDecision

public void setRetryDecision (IRetryDecision decision)

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

Tham số
decision IRetryDecision