CollectingTestListener
public class CollectingTestListener
extends Object
implements ITestInvocationListener, ILogSaverListener
java.lang.Object | |
↳ | com.android.tradefed.result.CollectingTestListener |
A 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) 戻り |
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, testMetrics) testEnded (TestDescription test, long endTime, testMetrics) |
void | testEnded (TestDescription test, testMetrics) testEnded (TestDescription test, testMetrics) |
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, runMetrics) testRunEnded (long elapsedTime, runMetrics) |
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 |
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 |
getTestRunAtAttempt
public TestRunResult getTestRunAtAttempt (String testRunName, int attempt)
戻りTestRunResult
、単一の試みのために。
パラメーター | |
---|---|
testRunName | String :{によって与えられた名前testRunStarted(String, int) 。 |
attempt | int :試行ID。 |
戻り値 | |
---|---|
TestRunResult | TestRunResult 指定された名前と試みIDまたはのための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 |