CollectingTestListener
public
class
CollectingTestListener
extends Object
implements
ITestInvocationListener,
ILogSaverListener
java.lang.Object | |
↳ | com.android.tradefed.result.CollectingTestListener |
ITestInvocationListener
ที่จะรวบรวมผลการทดสอบทั้งหมด
แม้ว่าโครงสร้างข้อมูลที่ใช้ในออบเจ็กต์นี้จะปลอดภัยของเทรด แต่ก็ต้องมีการเรียกใช้ Callback ITestInvocationListener
ตามลำดับที่ถูกต้อง
สรุป
ช่างก่อสร้างสาธารณะ | |
---|---|
CollectingTestListener()
|
วิธีการสาธารณะ | |
---|---|
IBuildInfo
|
getBuildInfo()
วิธีนี้เลิกใช้งานแล้ว
อาศัย |
TestRunResult
|
getCurrentRunResults()
รับผลลัพธ์ของการทดสอบปัจจุบัน |
int
|
getExpectedTests()
แสดงผลจำนวนการทดสอบที่คาดไว้ |
IInvocationContext
|
getInvocationContext()
แสดงบริบทการเรียกใช้ที่รายงานผ่าน |
|
getMergedTestRunResults()
แสดงคอลเล็กชันผลลัพธ์ที่รวมสำหรับการเรียกใช้ทั้งหมดหลายครั้ง |
IInvocationContext
|
getModuleContextForRunResult(String testRunName)
แสดง |
MultiMap<String, LogFile>
|
getModuleLogFiles()
แสดงสำเนาของแผนที่ซึ่งมีไฟล์บันทึกทั้งหมดที่เกี่ยวข้องกับโมดูล |
MultiMap<String, LogFile>
|
getNonAssociatedLogFiles()
แสดงสำเนาของแผนที่ซึ่งมีไฟล์บันทึกทั้งหมดที่ไม่เกี่ยวข้องกับการทดสอบหรือ |
int
|
getNumAllFailedTestRuns()
ส่งคืนจำนวนการทดสอบทั้งหมดที่ดำเนินการในสถานะล้มเหลว |
int
|
getNumAllFailedTests()
แสดงจำนวนการทดสอบทั้งหมดที่อยู่ในสถานะล้มเหลว (ล้มเหลวเท่านั้น โดยถือว่าความล้มเหลวไม่เท่ากับ ด้วย) |
int
|
getNumTestsInState(TestResult.TestStatus status)
แสดงจำนวนการทดสอบในสถานะที่ระบุสำหรับการเรียกใช้นี้ |
int
|
getNumTotalTests()
แสดงผลจำนวนการทดสอบที่สมบูรณ์สำหรับการเรียกใช้ทั้งหมด |
IBuildInfo
|
getPrimaryBuildInfo()
แสดงข้อมูลบิลด์หลักที่รายงานผ่าน |
|
getRunResults()
วิธีนี้เลิกใช้งานแล้ว
ใช้ |
TestRunResult
|
getTestRunAtAttempt(String testRunName, int attempt)
คืนเงิน |
int
|
getTestRunAttemptCount(String testRunName)
แสดงผลจำนวนครั้งของชื่อดำเนินการทดสอบที่ระบุ |
|
getTestRunAttempts(String testRunName)
รับความพยายามทั้งหมดสำหรับ |
|
getTestRunForAttempts(int attempt)
รับผลลัพธ์ทั้งหมดสำหรับความพยายามครั้งหนึ่งๆ |
|
getTestRunNames()
แสดงชื่อทั้งหมดของการเรียกใช้การทดสอบทั้งหมด |
boolean
|
hasFailedTests()
แสดงผลหากการเรียกใช้มีการทดสอบล้มเหลวหรือการทดสอบล้มเหลว |
boolean
|
hasTestRunResultsForName(String testRunName)
แสดงผลว่าชื่อการเรียกใช้ทดสอบที่ระบุมีผลลัพธ์หรือไม่ |
void
|
invocationEnded(long elapsedTime)
|
void
|
invocationFailed(Throwable cause)
|
void
|
invocationStarted(IInvocationContext context)
|
void
|
logAssociation(String dataName, LogFile logFile)
|
void
|
setBuildInfo(IBuildInfo buildInfo)
วิธีนี้เลิกใช้งานแล้ว ไม่จำเป็นสำหรับการทดสอบอีกต่อไป |
void
|
setMergeStrategy(MergeStrategy strategy)
ตั้งค่า |
void
|
testAssumptionFailure(TestDescription test, String trace)
|
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
|
void
|
testEnded(TestDescription test, long endTime,
|
void
|
testEnded(TestDescription test,
|
void
|
testFailed(TestDescription test, FailureDescription failure)
|
void
|
testFailed(TestDescription test, String trace)
|
void
|
testIgnored(TestDescription test)
|
void
|
testModuleEnded()
|
void
|
testModuleStarted(IInvocationContext moduleContext)
|
void
|
testRunEnded(long elapsedTime,
|
void
|
testRunFailed(FailureDescription failure)
|
void
|
testRunFailed(String errorMessage)
|
void
|
testRunStarted(String name, int numTests, int attemptNumber)
|
void
|
testRunStarted(String name, int numTests)
|
void
|
testRunStarted(String name, int numTests, int attemptNumber, long startTime)
|
void
|
testRunStopped(long elapsedTime)
|
void
|
testStarted(TestDescription test, long startTime)
|
void
|
testStarted(TestDescription test)
|
วิธีการป้องกัน | |
---|---|
final
void
|
clearModuleLogFiles()
อนุญาตให้ล้างไฟล์โมดูลเพื่อหลีกเลี่ยงการพกไฟล์โมดูลนานเกินไป |
final
void
|
clearResultsForName(String testRunName)
อนุญาตให้ล้างผลลัพธ์ของชื่อการเรียกใช้ที่ระบุ |
void
|
setIsAggregrateMetrics(boolean aggregate)
สลับ "เมตริกรวม" ตัวเลือก |
ช่างก่อสร้างสาธารณะ
CollectingTestListener
public CollectingTestListener ()
วิธีการสาธารณะ
getBuildInfo
public IBuildInfo getBuildInfo ()
วิธีนี้เลิกใช้งานแล้ว
อาศัย IBuildInfo
จาก getInvocationContext()
แสดงผลข้อมูลบิลด์
คิกรีเทิร์น | |
---|---|
IBuildInfo |
getCurrentRunผลลัพธ์
public TestRunResult getCurrentRunResults ()
รับผลลัพธ์ของการทดสอบปัจจุบัน
โปรดทราบว่าผลลัพธ์อาจไม่สมบูรณ์ ขอแนะนำให้ทดสอบค่าของ TestRunResult.isRunComplete()
และ/หรือ (@link TestRunResult#isRunFailure()} ตามความเหมาะสม
ก่อนประมวลผลผลลัพธ์
คิกรีเทิร์น | |
---|---|
TestRunResult |
TestRunResult ซึ่งแสดงข้อมูลที่รวบรวมจากการทดสอบครั้งล่าสุด
|
การทดสอบคาดหวัง
public int getExpectedTests ()
แสดงผลจำนวนการทดสอบที่คาดไว้ อาจแตกต่างจาก getNumTotalTests()
หาก
การทดสอบบางรายการไม่ทำงาน
คิกรีเทิร์น | |
---|---|
int |
getInvocationContext
public IInvocationContext getInvocationContext ()
แสดงบริบทการเรียกใช้ที่รายงานผ่าน invocationStarted(com.android.tradefed.invoker.IInvocationContext)
คิกรีเทิร์น | |
---|---|
IInvocationContext |
getMergedTestRunผลลัพธ์
publicgetMergedTestRunResults ()
แสดงคอลเล็กชันผลลัพธ์ที่รวมสำหรับการเรียกใช้ทั้งหมดหลายครั้ง
หากมีผลลัพธ์หลายรายการ ระบบจะผสานรวมผลการทดสอบล่าสุดเข้ากับผลการทดสอบล่าสุด การเขียนทับผลการทดสอบของการเรียกใช้ก่อนหน้า การทำการทดสอบจะเรียงลำดับตามจำนวนครั้งที่พยายาม
เมตริกสําหรับการพยายามเดียวกันจะผสานรวมตามค่ากำหนดที่ aggregate-metrics
ตั้งไว้ เมตริกสุดท้ายจะเป็นเมตริกของความพยายามครั้งสุดท้าย
คิกรีเทิร์น | |
---|---|
|
รับโมดูลบริบทสำหรับผลการเรียกใช้
public IInvocationContext getModuleContextForRunResult (String testRunName)
แสดง IInvocationContext
ของโมดูลที่เกี่ยวข้องกับผลลัพธ์
พารามิเตอร์ | |
---|---|
testRunName |
String : ชื่อที่ตั้งโดย {testRunStarted(String, int) |
คิกรีเทิร์น | |
---|---|
IInvocationContext |
IInvocationContext ของโมดูลสำหรับชื่อการเรียกใช้การทดสอบที่ระบุ null
หากไม่มีผลการค้นหาสำหรับชื่อนั้น
|
getModuleLogFiles (ไฟล์โมดูล)
public MultiMap<String, LogFile> getModuleLogFiles ()
แสดงสำเนาของแผนที่ซึ่งมีไฟล์บันทึกทั้งหมดที่เกี่ยวข้องกับโมดูล
คิกรีเทิร์น | |
---|---|
MultiMap<String, LogFile> |
getNonAssociatedLogFiles
public MultiMap<String, LogFile> getNonAssociatedLogFiles ()
แสดงสำเนาของแผนที่ซึ่งมีไฟล์บันทึกทั้งหมดที่ไม่เกี่ยวข้องกับการทดสอบหรือ
คิกรีเทิร์น | |
---|---|
MultiMap<String, LogFile> |
getNumAllFailedTestRuns
public int getNumAllFailedTestRuns ()
ส่งคืนจำนวนการทดสอบทั้งหมดที่ดำเนินการในสถานะล้มเหลว
คิกรีเทิร์น | |
---|---|
int |
getNumAllFailedTests
public int getNumAllFailedTests ()
แสดงจำนวนการทดสอบทั้งหมดที่อยู่ในสถานะล้มเหลว (ล้มเหลวเท่านั้น โดยถือว่าความล้มเหลวไม่เท่ากับ ด้วย)
คิกรีเทิร์น | |
---|---|
int |
getNumTestsInState
public int getNumTestsInState (TestResult.TestStatus status)
แสดงจำนวนการทดสอบในสถานะที่ระบุสำหรับการเรียกใช้นี้
พารามิเตอร์ | |
---|---|
status |
TestResult.TestStatus |
คิกรีเทิร์น | |
---|---|
int |
getNumTotalTests
public int getNumTotalTests ()
แสดงผลจำนวนการทดสอบที่สมบูรณ์สำหรับการเรียกใช้ทั้งหมด
คิกรีเทิร์น | |
---|---|
int |
getPrimaryBuildInfo
public IBuildInfo getPrimaryBuildInfo ()
แสดงข้อมูลบิลด์หลักที่รายงานผ่าน invocationStarted(com.android.tradefed.invoker.IInvocationContext)
บิลด์หลักคือบิลด์ที่แสดงผลโดยรายการแรก
ผู้ให้บริการบิลด์ของการกำหนดค่าที่ทำงานอยู่ ส่งคืนค่า Null หากไม่มีบริบท (ไม่มีบิลด์สำหรับ
กรอบการทดสอบ)
คิกรีเทิร์น | |
---|---|
IBuildInfo |
getRunผลลัพธ์
publicgetRunResults ()
วิธีนี้เลิกใช้งานแล้ว
ใช้getMergedTestRunResults()
แสดงผลลัพธ์สำหรับการเรียกใช้การทดสอบทั้งหมด
คิกรีเทิร์น | |
---|---|
|
พยายามรับการเริ่มทดสอบ
public TestRunResult getTestRunAtAttempt (String testRunName, int attempt)
คืนเงิน TestRunResult
เพียงครั้งเดียว
พารามิเตอร์ | |
---|---|
testRunName |
String : ชื่อที่ตั้งโดย {testRunStarted(String, int) |
attempt |
int : รหัสความพยายาม |
คิกรีเทิร์น | |
---|---|
TestRunResult |
TestRunResult สำหรับชื่อหนึ่งๆ และรหัสความพยายามหรือ null หากชื่อนั้น
ไม่มีอยู่
|
จำนวนการลองเรียกใช้ getTest
public int getTestRunAttemptCount (String testRunName)
แสดงผลจำนวนครั้งของชื่อดำเนินการทดสอบที่ระบุ
พารามิเตอร์ | |
---|---|
testRunName |
String : ชื่อที่ตั้งโดย {testRunStarted(String, int)
|
คิกรีเทิร์น | |
---|---|
int |
ความพยายามในการทดสอบ getTest
publicgetTestRunAttempts (String testRunName)
รับความพยายามทั้งหมดสำหรับ TestRunResult
ของการทดสอบแต่ละครั้ง
พารามิเตอร์ | |
---|---|
testRunName |
String : ชื่อที่ตั้งโดย {testRunStarted(String, int) |
คิกรีเทิร์น | |
---|---|
|
TestRunResult ทั้งหมดสำหรับการดำเนินการทดสอบหนึ่งๆ เรียงลำดับตามจำนวนครั้งที่พยายาม
|
getTestRunForAttempts
publicgetTestRunForAttempts (int attempt)
รับผลลัพธ์ทั้งหมดสำหรับความพยายามครั้งหนึ่งๆ
พารามิเตอร์ | |
---|---|
attempt |
int : ความพยายามที่เราต้องการผลลัพธ์ |
คิกรีเทิร์น | |
---|---|
|
TestRunResult ทั้งหมดสำหรับการพยายามครั้งเดียว
|
getTestRunNames
publicgetTestRunNames ()
แสดงชื่อทั้งหมดของการเรียกใช้การทดสอบทั้งหมด
การดำเนินการทดสอบเหล่านี้อาจทำหลายครั้งด้วยการดำเนินการที่แตกต่างกัน
คิกรีเทิร์น | |
---|---|
|
การทดสอบล้มเหลว
public boolean hasFailedTests ()
แสดงผลหากการเรียกใช้มีการทดสอบล้มเหลวหรือการทดสอบล้มเหลว
คิกรีเทิร์น | |
---|---|
boolean |
มีผลการทดสอบสำหรับชื่อ
public boolean hasTestRunResultsForName (String testRunName)
แสดงผลว่าชื่อการเรียกใช้ทดสอบที่ระบุมีผลลัพธ์หรือไม่
พารามิเตอร์ | |
---|---|
testRunName |
String : ชื่อที่ตั้งโดย {testRunStarted(String, int)
|
คิกรีเทิร์น | |
---|---|
boolean |
สิ้นสุดการเรียกใช้
public void invocationEnded (long elapsedTime)
พารามิเตอร์ | |
---|---|
elapsedTime |
long |
การเรียกใช้ล้มเหลว
public void invocationFailed (Throwable cause)
พารามิเตอร์ | |
---|---|
cause |
Throwable |
เริ่มคำขอแล้ว
public void invocationStarted (IInvocationContext context)
พารามิเตอร์ | |
---|---|
context |
IInvocationContext |
การเชื่อมโยงบันทึก
public void logAssociation (String dataName, LogFile logFile)
พารามิเตอร์ | |
---|---|
dataName |
String |
logFile |
LogFile |
ตั้งค่า BuildInfo
public void setBuildInfo (IBuildInfo buildInfo)
วิธีนี้เลิกใช้งานแล้ว
ไม่จำเป็นสำหรับการทดสอบอีกต่อไป
ตั้งค่าข้อมูลบิลด์ ควรใช้สำหรับการทดสอบเท่านั้น
พารามิเตอร์ | |
---|---|
buildInfo |
IBuildInfo |
ตั้งค่าการผสานกลยุทธ์
public void setMergeStrategy (MergeStrategy strategy)
ตั้งค่า MergeStrategy
ที่จะใช้เมื่อรวมผลลัพธ์
พารามิเตอร์ | |
---|---|
strategy |
MergeStrategy |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
trace |
String |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
failure |
FailureDescription |
สิ้นสุดการทดสอบ
public void testEnded (TestDescription test, long endTime,testMetrics)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
endTime |
long |
testMetrics |
|
สิ้นสุดการทดสอบ
public void testEnded (TestDescription test,testMetrics)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
testMetrics |
|
การทดสอบล้มเหลว
public void testFailed (TestDescription test, FailureDescription failure)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
failure |
FailureDescription |
การทดสอบล้มเหลว
public void testFailed (TestDescription test, String trace)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
trace |
String |
ละเว้นการทดสอบแล้ว
public void testIgnored (TestDescription test)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
โมดูลทดสอบสิ้นสุดแล้ว
public void testModuleEnded ()
testModuleStarted แล้ว
public void testModuleStarted (IInvocationContext moduleContext)
พารามิเตอร์ | |
---|---|
moduleContext |
IInvocationContext |
สิ้นสุดการทดสอบแล้ว
public void testRunEnded (long elapsedTime,runMetrics)
พารามิเตอร์ | |
---|---|
elapsedTime |
long |
runMetrics |
|
testRunFailed
public void testRunFailed (FailureDescription failure)
พารามิเตอร์ | |
---|---|
failure |
FailureDescription |
testRunFailed
public void testRunFailed (String errorMessage)
พารามิเตอร์ | |
---|---|
errorMessage |
String |
เริ่มการทดสอบแล้ว
public void testRunStarted (String name, int numTests, int attemptNumber)
พารามิเตอร์ | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
เริ่มการทดสอบแล้ว
public void testRunStarted (String name, int numTests)
พารามิเตอร์ | |
---|---|
name |
String |
numTests |
int |
เริ่มการทดสอบแล้ว
public void testRunStarted (String name, int numTests, int attemptNumber, long startTime)
พารามิเตอร์ | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
startTime |
long |
หยุดการทดสอบแล้ว
public void testRunStopped (long elapsedTime)
พารามิเตอร์ | |
---|---|
elapsedTime |
long |
เริ่มทดสอบแล้ว
public void testStarted (TestDescription test, long startTime)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
startTime |
long |
เริ่มทดสอบแล้ว
public void testStarted (TestDescription test)
พารามิเตอร์ | |
---|---|
test |
TestDescription |
วิธีการป้องกัน
clearModuleLogFiles
protected final void clearModuleLogFiles ()
อนุญาตให้ล้างไฟล์โมดูลเพื่อหลีกเลี่ยงการพกไฟล์โมดูลนานเกินไป
ล้างผลลัพธ์สำหรับชื่อ
protected final void clearResultsForName (String testRunName)
อนุญาตให้ล้างผลลัพธ์ของชื่อการเรียกใช้ที่ระบุ ควรใช้ในบางกรณีเท่านั้น เช่น ผู้รวบรวมผลลัพธ์
พารามิเตอร์ | |
---|---|
testRunName |
String |
setIsAggregrateMetrics
protected void setIsAggregrateMetrics (boolean aggregate)
สลับ "เมตริกรวม" ตัวเลือก
พารามิเตอร์ | |
---|---|
aggregate |
boolean |