CollectingTestListener
public
class
CollectingTestListener
extends Object
implements
ITestInvocationListener,
ILogSaverListener
java.lang.Object | |
↳ | com.android.tradefed.result.CollectingTestListener |
すべてのテスト結果を収集する ITestInvocationListener
。
このオブジェクトで使用されるデータ構造はスレッドセーフですが、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)
1 回の試行で |
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 ()
このメソッドは非推奨です。
は getInvocationContext()
の IBuildInfo
に依存します。
ビルド情報を返します。
戻り値 | |
---|---|
IBuildInfo |
getCurrentRunResults
public TestRunResult getCurrentRunResults ()
現在のテスト実行の結果を取得します。
結果が不完全な場合があります。結果を処理する前に、TestRunResult.isRunComplete()
の値や(必要に応じて)@link TestRunResult#isRunFailure()} をテストすることをおすすめします。
戻り値 | |
---|---|
TestRunResult |
TestRunResult : 前回のテスト実行中に収集されたデータを表します。 |
getExpectedTests
public int getExpectedTests ()
想定されるテスト数を返します。一部のテストが実行されていない場合は、getNumTotalTests()
と異なる場合があります。
戻り値 | |
---|---|
int |
getInvocationContext
public IInvocationContext getInvocationContext ()
invocationStarted(com.android.tradefed.invoker.IInvocationContext)
を介して報告された呼び出しコンテキストを返します。
戻り値 | |
---|---|
IInvocationContext |
getMergedTestRunResults
publicgetMergedTestRunResults ()
さまざまな試行のすべての実行の結果を統合したコレクションを返します。
結果が複数ある場合は、各テスト実行が統合され、最新のテスト結果が以前の実行のテスト結果を上書きします。テスト実行は試行回数で並べ替えられます。
同じ試行の指標は、aggregate-metrics
で設定された設定に基づいて統合されます。最終的な指標は、最後の試行の指標になります。
戻り値 | |
---|---|
|
getModuleContextForRunResult
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 |
getRunResults
publicgetRunResults ()
このメソッドは非推奨です。
getMergedTestRunResults()
を使用します
すべてのテスト実行の結果を返します。
戻り値 | |
---|---|
|
getTestRunAtAttempt
public TestRunResult getTestRunAtAttempt (String testRunName, int attempt)
1 回目の試行で TestRunResult
を返します。
パラメータ | |
---|---|
testRunName |
String : {testRunStarted(String, int) によって指定された名前。 |
attempt |
int : 試行 ID。 |
戻り値 | |
---|---|
TestRunResult |
指定された名前と試行 ID の TestRunResult 。存在しない場合は null 。 |
getTestRunAttemptCount
public int getTestRunAttemptCount (String testRunName)
指定されたテスト実行名の試行回数を返します。
パラメータ | |
---|---|
testRunName |
String : {testRunStarted(String, int) によって指定された名前。 |
戻り値 | |
---|---|
int |
getTestRunAttempts
publicgetTestRunAttempts (String testRunName)
特定のテスト実行の TestRunResult
のすべての試行を取得します。
パラメータ | |
---|---|
testRunName |
String : {testRunStarted(String, int) によって指定された名前。 |
戻り値 | |
---|---|
|
特定のテスト実行のすべての TestRunResult (試行順に並べ替え)。 |
getTestRunForAttempts
publicgetTestRunForAttempts (int attempt)
特定の試行のすべての結果を取得します。
パラメータ | |
---|---|
attempt |
int : 結果を取得する試行。 |
戻り値 | |
---|---|
|
特定の試行のすべての TestRunResult 。 |
getTestRunNames
publicgetTestRunNames ()
すべてのテスト実行の名前をすべて返します。
これらのテスト実行は、異なる試行で複数回実行されている可能性があります。
戻り値 | |
---|---|
|
hasFailedTests
public boolean hasFailedTests ()
呼び出しで失敗したテストまたは前提条件が失敗したテストがあったかどうかを返します。
戻り値 | |
---|---|
boolean |
hasTestRunResultsForName
public boolean hasTestRunResultsForName (String testRunName)
指定されたテスト実行名に結果があるかどうかを返します。
パラメータ | |
---|---|
testRunName |
String : {testRunStarted(String, int) によって指定された名前。 |
戻り値 | |
---|---|
boolean |
invocationEnded
public void invocationEnded (long elapsedTime)
パラメータ | |
---|---|
elapsedTime |
long |
invocationFailed
public void invocationFailed (Throwable cause)
パラメータ | |
---|---|
cause |
Throwable |
invocationStarted
public void invocationStarted (IInvocationContext context)
パラメータ | |
---|---|
context |
IInvocationContext |
logAssociation
public void logAssociation (String dataName, LogFile logFile)
パラメータ | |
---|---|
dataName |
String |
logFile |
LogFile |
setBuildInfo
public void setBuildInfo (IBuildInfo buildInfo)
このメソッドは非推奨です。
テストでは不要になりました。
ビルド情報を設定します。テスト専用です。
パラメータ | |
---|---|
buildInfo |
IBuildInfo |
setMergeStrategy
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 |
testEnded
public void testEnded (TestDescription test, long endTime,testMetrics)
パラメータ | |
---|---|
test |
TestDescription |
endTime |
long |
testMetrics |
|
testEnded
public void testEnded (TestDescription test,testMetrics)
パラメータ | |
---|---|
test |
TestDescription |
testMetrics |
|
testFailed
public void testFailed (TestDescription test, FailureDescription failure)
パラメータ | |
---|---|
test |
TestDescription |
failure |
FailureDescription |
testFailed
public void testFailed (TestDescription test, String trace)
パラメータ | |
---|---|
test |
TestDescription |
trace |
String |
testIgnored
public void testIgnored (TestDescription test)
パラメータ | |
---|---|
test |
TestDescription |
testModuleEnded
public void testModuleEnded ()
testModuleStarted
public void testModuleStarted (IInvocationContext moduleContext)
パラメータ | |
---|---|
moduleContext |
IInvocationContext |
testRunEnded
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 |
testRunStarted
public void testRunStarted (String name, int numTests, int attemptNumber)
パラメータ | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
testRunStarted
public void testRunStarted (String name, int numTests)
パラメータ | |
---|---|
name |
String |
numTests |
int |
testRunStarted
public void testRunStarted (String name, int numTests, int attemptNumber, long startTime)
パラメータ | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
startTime |
long |
testRunStopped
public void testRunStopped (long elapsedTime)
パラメータ | |
---|---|
elapsedTime |
long |
testStarted
public void testStarted (TestDescription test, long startTime)
パラメータ | |
---|---|
test |
TestDescription |
startTime |
long |
testStarted
public void testStarted (TestDescription test)
パラメータ | |
---|---|
test |
TestDescription |
保護されたメソッド
clearModuleLogFiles
protected final void clearModuleLogFiles ()
モジュール ファイルをクリーンアップして、長時間保持しないようにします。
clearResultsForName
protected final void clearResultsForName (String testRunName)
特定の実行名の結果を消去できます。結果のアグリゲータなど、一部のケースでのみ使用してください。
パラメータ | |
---|---|
testRunName |
String |
setIsAggregrateMetrics
protected void setIsAggregrateMetrics (boolean aggregate)
[指標を集計] オプションを切り替える
パラメータ | |
---|---|
aggregate |
boolean |