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 loại 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 kiểm thử này được xử lý một cách tổng thể: Khi IRemoteTest chạy, tất cả các trường hợp kiểm thử này sẽ chạy. Một số IRemoteTest (Những cái 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 các 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ộ thử nghiệm.

  • Một trường hợp thử nghiệm có thể được thử lại nhiều lần (trong cùng một lần chạy IRemoteTest) để giảm tỷ lệ lỗi không phải do lỗi kiểm tra.
  • Các trường hợp thử nghiệm lại được thu thập động từ các lỗi chạy 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 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 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 để phát hiện phần bắt đầu và kết thúc lượt chạy bị thiếu.

Nhà thầu xây dựng 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 pháp 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ề trình nghe 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 thập 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 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 sử dụng.

Nhà thầu xây dựng 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 pháp 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ề trình nghe 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 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 thập 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ý.

setMarkTestsBỏ qua

public void setMarkTestsSkipped (boolean skipTestCases)

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

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

setMetricCollectors

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 ModuleConfig của ModuleDefinition 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.

setThử lạiQuyết định

public void setRetryDecision (IRetryDecision decision)

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

Thông số
decision IRetryDecision