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.

GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

java.lang.Object
com.android.ddmlib.MultiLineReceiver
com.android.tradefed.testtype.GTestResultParser


Phân tích cú pháp kết quả 'chế độ đầu ra thô' của các thử nghiệm gốc bằng cách sử dụng GTest chạy từ trình bao và thông báo cho ITestInvocationListener về kết quả.

Dự kiến ​​định dạng mẫu của đầu ra:

 [==========] Running 15 tests from 1 test case.
 [----------] Global test environment set-up.
 [----------] 15 tests from MessageTest
 [ RUN      ] MessageTest.DefaultConstructor
 [       OK ] MessageTest.DefaultConstructor (1 ms)
 [ RUN      ] MessageTest.CopyConstructor
 external/gtest/test/gtest-message_test.cc:67: Failure
 Value of: 5
 Expected: 2
 external/gtest/test/gtest-message_test.cc:68: Failure
 Value of: 1 == 1
 Actual: true
 Expected: false
 [  FAILED  ] MessageTest.CopyConstructor (2 ms)
  ...
 [ RUN      ] MessageTest.DoesNotTakeUpMuchStackSpace
 [       OK ] MessageTest.DoesNotTakeUpMuchStackSpace (0 ms)
 [----------] 15 tests from MessageTest (26 ms total)

 [----------] Global test environment tear-down
 [==========] 15 tests from 1 test case ran. (26 ms total)
 [  PASSED  ] 6 tests.
 [  FAILED  ] 9 tests, listed below:
 [  FAILED  ] MessageTest.CopyConstructor
 [  FAILED  ] MessageTest.ConstructsFromCString
 [  FAILED  ] MessageTest.StreamsCString
 [  FAILED  ] MessageTest.StreamsNullCString
 [  FAILED  ] MessageTest.StreamsString
 [  FAILED  ] MessageTest.StreamsStringWithEmbeddedNUL
 [  FAILED  ] MessageTest.StreamsNULChar
 [  FAILED  ] MessageTest.StreamsInt
 [  FAILED  ] MessageTest.StreamsBasicIoManip
 9 FAILED TESTS
 

trong đó các thẻ sau được sử dụng để báo hiệu các sự kiện nhất định:

 [==========]: the first occurrence indicates a new run started, including the number of tests
                  to be expected in this run
 [ RUN      ]: indicates a new test has started to run; a series of zero or more lines may
                  follow a test start, and will be captured in case of a test failure or error
 [       OK ]: the preceding test has completed successfully, optionally including the time it
                  took to run (in ms)
 [  FAILED  ]: the preceding test has failed, optionally including the time it took to run (in ms)
 [==========]: the preceding test run has completed, optionally including the time it took to run
                  (in ms)
 
Tất cả các dòng khác đều bị bỏ qua.

Bản tóm tắt

nhà thầu công cộng

GTestResultParser (String testRunName, listeners) GTestResultParser (String testRunName, listeners)

Tạo GTestResultParser.

Phương thức công khai

void cancel ()

Yêu cầu hủy chạy thử.

void done ()

Được gọi bởi phụ huynh khi phiên adb hoàn tất.

boolean getPrependFileName ()
boolean isCancelled ()

Trả về true nếu quá trình chạy thử bị hủy.

void processNewLines (String[] lines)

void setPrependFileName (boolean prepend)

nhà thầu công cộng

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners)

Tạo GTestResultParser.

Thông số
testRunName String : tên chạy thử để cung cấp cho ITestLifeCycleReceiver.testRunStarted(String, int)

listeners : thông báo về kết quả kiểm tra khi các bài kiểm tra đang được thực hiện

Phương thức công khai

Hủy bỏ

public void cancel ()

Yêu cầu hủy chạy thử.

xong

public void done ()

Được gọi bởi phụ huynh khi phiên adb hoàn tất.

getPrependFileName

public boolean getPrependFileName ()

trả lại
boolean

bị hủy

public boolean isCancelled ()

Trả về true nếu quá trình chạy thử bị hủy.

trả lại
boolean

quy trìnhNewLines

public void processNewLines (String[] lines)

Thông số
lines String

setPrependFileName

public void setPrependFileName (boolean prepend)

Thông số
prepend boolean