BasePostProcessor

public abstract class BasePostProcessor
extends Object implements IPostProcessor

java.lang.Object
   ↳ com.android.tradefed.postprocessor.BasePostProcessor


IPostProcessor cơ sở mà mọi hoạt động triển khai đều phải mở rộng. Đảm bảo rằng các phương thức xử lý sau được gọi trước trình báo cáo kết quả cuối cùng.

Tóm tắt

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

BasePostProcessor()

Phương thức công khai

final ITestInvocationListener init(ITestInvocationListener listener)

Bước khởi chạy của trình xử lý hậu kỳ.

final void invocationEnded(long elapsedTime)
final void invocationFailed(FailureDescription failure)
final void invocationFailed(Throwable cause)
final void invocationStarted(IInvocationContext context)

Trình nghe lệnh gọi để chuyển tiếp

final boolean isDisabled()

Trả về True nếu toàn bộ đối tượng bị tắt (bỏ qua cả quá trình thiết lập và gỡ bỏ).

final void logAssociation(String dataName, LogFile logFile)

Cập nhật mối liên kết nhật ký-kiểm thử.

processAllTestMetricsAndLogs(ListMultimap<String, MetricMeasurement.Metric> allTestMetrics, allTestLogs)

Triển khai phương thức này để tổng hợp các chỉ số và nhật ký trên tất cả các bài kiểm thử.

abstract processRunMetricsAndLogs( rawMetrics, runLogs)

Triển khai phương thức này để tạo một tập hợp các chỉ số mới từ các chỉ số và nhật ký hiện có.

processTestMetricsAndLogs(TestDescription testDescription, testMetrics, testLogs)

Triển khai phương thức này để đăng các chỉ số và nhật ký xử lý từ mỗi lần kiểm thử.

final void setLogSaver(ILogSaver logSaver)
final void testAssumptionFailure(TestDescription test, String trace)
final void testAssumptionFailure(TestDescription test, FailureDescription failure)
final void testEnded(TestDescription test, long endTime, testMetrics)
final void testEnded(TestDescription test, testMetrics)
final void testFailed(TestDescription test, FailureDescription failure)
final void testFailed(TestDescription test, String trace)
final void testIgnored(TestDescription test)
final void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

Sử dụng phương thức này để ghi nhật ký tệp từ quá trình triển khai PostProcessor.

final void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
final void testModuleEnded()
final void testModuleStarted(IInvocationContext moduleContext)
final void testRunEnded(long elapsedTime, runMetrics)
final void testRunFailed(FailureDescription failure)
final void testRunFailed(String errorMessage)
final void testRunStarted(String runName, int testCount, int attemptNumber)
final void testRunStarted(String runName, int testCount)

Kiểm thử lệnh gọi lại khi chạy

final void testRunStopped(long elapsedTime)
final void testStarted(TestDescription test, long startTime)
final void testStarted(TestDescription test)

Lệnh gọi lại trường hợp kiểm thử

Phương thức được bảo vệ

MetricMeasurement.DataType getMetricType()

Ghi đè phương thức này để thay đổi loại chỉ số nếu cần.

String getRunName()

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

BasePostProcessor

public BasePostProcessor ()

Phương thức công khai

khởi tạo

public final ITestInvocationListener init (ITestInvocationListener listener)

Bước khởi chạy của trình xử lý hậu kỳ. Đảm bảo được gọi trước mọi lệnh gọi lại kiểm thử.

Tham số
listener ITestInvocationListener

Giá trị trả về
ITestInvocationListener

invocationEnded

public final void invocationEnded (long elapsedTime)

Tham số
elapsedTime long

invocationFailed

public final void invocationFailed (FailureDescription failure)

Tham số
failure FailureDescription

invocationFailed

public final void invocationFailed (Throwable cause)

Tham số
cause Throwable

invocationStarted

public final void invocationStarted (IInvocationContext context)

Trình nghe lệnh gọi để chuyển tiếp

Tham số
context IInvocationContext

isDisabled

public final boolean isDisabled ()

Trả về True nếu toàn bộ đối tượng bị tắt (bỏ qua cả quá trình thiết lập và gỡ bỏ). Nếu không thì giá trị sẽ là false.

Giá trị trả về
boolean

logAssociation

public final void logAssociation (String dataName, 
                LogFile logFile)

Cập nhật mối liên kết nhật ký-kiểm thử. Nếu phương thức này được gọi trong quá trình kiểm thử, thì nhật ký thuộc về quá trình kiểm thử; nếu không, đó sẽ là nhật ký chạy.

Tham số
dataName String

logFile LogFile

processAllTestMetricsAndLogs

public  processAllTestMetricsAndLogs (ListMultimap<String, MetricMeasurement.Metric> allTestMetrics, 
                 allTestLogs)

Triển khai phương thức này để tổng hợp các chỉ số và nhật ký trên tất cả các bài kiểm thử. Các chỉ số xuất phát từ phương thức này sẽ được báo cáo dưới dạng chỉ số chạy. Chỉ các chỉ số mới tạo mới được trả về và có tên khoá duy nhất (không được trùng lặp với các khoá hiện có).

Tham số
allTestMetrics ListMultimap: HashMultimap lưu trữ các chỉ số từ mỗi lần kiểm thử được nhóm theo tên chỉ số.

allTestLogs : Một bản đồ lưu trữ bản đồ tệp nhật ký của mỗi kiểm thử được khoá bằng tên dữ liệu của các tệp đó, sử dụng TestDescription của mỗi kiểm thử làm khoá.

Giá trị trả về
Tập hợp các chỉ số mới được tạo từ tất cả các chỉ số kiểm thử.

processRunMetricsAndLogs

public abstract  processRunMetricsAndLogs ( rawMetrics, 
                 runLogs)

Triển khai phương thức này để tạo một tập hợp các chỉ số mới từ các chỉ số và nhật ký hiện có. Chỉ các chỉ số mới tạo mới được trả về và có tên khoá duy nhất (không được phép trùng lặp với các khoá hiện có).

Tham số
rawMetrics : Tập hợp các chỉ số thô có sẵn cho lần chạy.

runLogs : Tập hợp các tệp nhật ký cho lần chạy kiểm thử.

Giá trị trả về
Tập hợp các chỉ số mới được tạo từ chỉ số chạy.

processTestMetricsAndLogs

public  processTestMetricsAndLogs (TestDescription testDescription, 
                 testMetrics, 
                 testLogs)

Triển khai phương thức này để đăng các chỉ số và nhật ký xử lý từ mỗi lần kiểm thử. Chỉ các chỉ số mới được tạo mới được trả về và có tên khoá duy nhất (không được trùng lặp với các khoá hiện có).

Tham số
testDescription TestDescription: Đối tượng TestDescription mô tả kiểm thử.

testMetrics : Tập hợp các chỉ số từ kiểm thử.

testLogs : Tập hợp các tệp được ghi nhật ký trong quá trình kiểm thử.

Giá trị trả về
Tập hợp các chỉ số mới được tạo từ các chỉ số kiểm thử.

setLogSaver

public final void setLogSaver (ILogSaver logSaver)

Tham số
logSaver ILogSaver

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                String trace)

Tham số
test TestDescription

trace String

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

Tham số
test TestDescription

failure FailureDescription

testEnded

public final void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

Tham số
test TestDescription

endTime long

testMetrics

testEnded

public final void testEnded (TestDescription test, 
                 testMetrics)

Tham số
test TestDescription

testMetrics

testFailed

public final void testFailed (TestDescription test, 
                FailureDescription failure)

Tham số
test TestDescription

failure FailureDescription

testFailed

public final void testFailed (TestDescription test, 
                String trace)

Tham số
test TestDescription

trace String

testIgnored

public final void testIgnored (TestDescription test)

Tham số
test TestDescription

testLog

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

Sử dụng phương thức này để ghi nhật ký tệp từ quá trình triển khai PostProcessor.

Tham số
dataName String

dataType LogDataType

dataStream InputStreamSource

testLogSaved

public final void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

Tham số
dataName String

dataType LogDataType

dataStream InputStreamSource

logFile LogFile

testModuleEnded

public final void testModuleEnded ()

testModuleStarted

public final void testModuleStarted (IInvocationContext moduleContext)

Tham số
moduleContext IInvocationContext

testRunEnded

public final void testRunEnded (long elapsedTime, 
                 runMetrics)

Tham số
elapsedTime long

runMetrics

testRunFailed

public final void testRunFailed (FailureDescription failure)

Tham số
failure FailureDescription

testRunFailed

public final void testRunFailed (String errorMessage)

Tham số
errorMessage String

testRunStarted

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

Tham số
runName String

testCount int

attemptNumber int

testRunStarted

public final void testRunStarted (String runName, 
                int testCount)

Kiểm thử lệnh gọi lại khi chạy

Tham số
runName String

testCount int

testRunStopped

public final void testRunStopped (long elapsedTime)

Tham số
elapsedTime long

testStarted

public final void testStarted (TestDescription test, 
                long startTime)

Tham số
test TestDescription

startTime long

testStarted

public final void testStarted (TestDescription test)

Lệnh gọi lại trường hợp kiểm thử

Tham số
test TestDescription

Phương thức được bảo vệ

getMetricType

protected MetricMeasurement.DataType getMetricType ()

Ghi đè phương thức này để thay đổi loại chỉ số nếu cần. Theo mặc định, chỉ số được đặt thành loại đã xử lý.

Giá trị trả về
MetricMeasurement.DataType

getRunName

protected String getRunName ()

Giá trị trả về
String