DeviceTestCase

public class DeviceTestCase
extends MetricTestCase implements IDeviceTest, IRemoteTest, ITestAnnotationFilterReceiver, ITestCollector, ITestFilterReceiver

java.lang.Object
   ↳ junit.framework.Assert
     ↳ junit.framework.TestCase
       ↳ com.android.tradefed.testtype.MetricTestCase
         ↳ com.android.tradefed.testtype.DeviceTestCase


IRemoteTest サービスと IDeviceTest サービスを提供するヘルパー JUnit テストケース。

これは、JUnit パターンのテスト定義に沿ったテストを実装しつつ、Option などの他の tradefed 機能も完全にサポートしたい場合に便利です。

概要

フィールド

protected Set<String> mExcludeAnnotation

実行するテストの除外アノテーション

protected Set<String> mExcludeFilters

実行するテスト名の除外フィルタ

protected Set<String> mIncludeAnnotation

実行するテストの include アノテーション

protected Set<String> mIncludeFilters

実行するテスト名のインクルード フィルタ

パブリック コンストラクタ

DeviceTestCase()
DeviceTestCase(String name)

パブリック メソッド

void addAllExcludeAnnotation(Set<String> notAnnotations)

テストにマークされている場合に除外するアノテーションの Set を追加します。

void addAllExcludeFilters(Set<String> filters)

除外するテストのフィルタの Set を追加します。

void addAllIncludeAnnotation(Set<String> annotations)

テストがマークされている場合に含めるアノテーションの Set を追加します。

void addAllIncludeFilters(Set<String> filters)

含めるテストのフィルタの Set を追加します。

void addExcludeAnnotation(String notAnnotation)

テストにマークが付いている場合、除外するアノテーションを追加します。

void addExcludeFilter(String filter)

除外するテストのフィルタを追加します。

void addIncludeAnnotation(String annotation)

テストにマークが付いている場合に含めるアノテーションを追加します。

void addIncludeFilter(String filter)

含めるテストのフィルタを追加します。

void clearExcludeAnnotations()

現在トラッキングされている除外アノテーションをすべて削除します。

void clearExcludeFilters()

現在トラッキングされている除外フィルタをすべて削除します。

void clearIncludeAnnotations()

現在トラッキングされているすべてのインクルード アノテーションを削除します。

void clearIncludeFilters()

現在トラッキングされているすべての包含フィルタを削除します。

int countTestCases()
ITestDevice getDevice()

テスト対象デバイスを取得します。

Set<String> getExcludeAnnotations()

除外するアノテーションの現在の Set を返します。

Set<String> getExcludeFilters()

除外フィルタの現在の Set を返します。

Set<String> getIncludeAnnotations()

含めるアノテーションの現在の Set を返します。

Set<String> getIncludeFilters()

現在のインクルード フィルタの Set を返します。

void run(TestResult result)

実行するテストメソッドが null の場合、すべてのテストメソッドを実行するように親メソッドをオーバーライドします。

void run(TestInformation testInfo, ITestInvocationListener listener)

テストを実行し、結果をリスナーに報告します。

void setCollectTestsOnly(boolean shouldCollectTest)

テスト収集モードを有効または無効にします。

void setDevice(ITestDevice device)

テスト対象デバイスを挿入します。

フィールド

mExcludeAnnotation

protected Set<String> mExcludeAnnotation

実行するテストの除外アノテーション

mExcludeFilters

protected Set<String> mExcludeFilters

実行するテスト名の除外フィルタ

mIncludeAnnotation

protected Set<String> mIncludeAnnotation

実行するテストの include アノテーション

mIncludeFilters

protected Set<String> mIncludeFilters

実行するテスト名のインクルード フィルタ

パブリック コンストラクタ

DeviceTestCase

public DeviceTestCase ()

DeviceTestCase

public DeviceTestCase (String name)

パラメータ
name String

パブリック メソッド

addAllExcludeAnnotation

public void addAllExcludeAnnotation (Set<String> notAnnotations)

テストにマークされている場合に除外するアノテーションの Set を追加します。

パラメータ
notAnnotations Set

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

除外するテストのフィルタの Set を追加します。

パラメータ
filters Set

addAllIncludeAnnotation

public void addAllIncludeAnnotation (Set<String> annotations)

テストがマークされている場合に含めるアノテーションの Set を追加します。

パラメータ
annotations Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

テストに含めるフィルタの Set を追加します。

パラメータ
filters Set

addExcludeAnnotation

public void addExcludeAnnotation (String notAnnotation)

テストにマークが付いている場合に除外するアノテーションを追加します。

パラメータ
notAnnotation String

addExcludeFilter

public void addExcludeFilter (String filter)

除外するテストのフィルタを追加します。

パラメータ
filter String

addIncludeAnnotation

public void addIncludeAnnotation (String annotation)

テストにマークが付いている場合に含めるアノテーションを追加します。

パラメータ
annotation String

addIncludeFilter

public void addIncludeFilter (String filter)

含めるテストのフィルタを追加します。

パラメータ
filter String

clearExcludeAnnotations

public void clearExcludeAnnotations ()

現在トラッキングされている除外アノテーションをすべて削除します。

clearExcludeFilters

public void clearExcludeFilters ()

現在トラッキングされている除外フィルタをすべて削除します。

clearIncludeAnnotations

public void clearIncludeAnnotations ()

現在トラッキングされているインクルード アノテーションをすべて削除します。

clearIncludeFilters

public void clearIncludeFilters ()

現在トラッキングされているすべての除外フィルタを削除します。

countTestCases

public int countTestCases ()

戻り値
int

getDevice

public ITestDevice getDevice ()

テスト対象デバイスを取得します。

戻り値
ITestDevice ITestDevice

getExcludeAnnotations

public Set<String> getExcludeAnnotations ()

除外するアノテーションの現在の Set を返します。

戻り値
Set<String>

getExcludeFilters

public Set<String> getExcludeFilters ()

除外フィルタの現在の Set を返します。

戻り値
Set<String>

getIncludeAnnotations

public Set<String> getIncludeAnnotations ()

含めるアノテーションの現在の Set を返します。

戻り値
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

インクルード フィルタの現在の Set を返します。

戻り値
Set<String>

run

public void run (TestResult result)

実行するテストメソッドが null の場合、すべてのテストメソッドを実行するように親メソッドをオーバーライドします。

JUnit フレームワークは、TestCase を TestSuite でラップすることで、TestCase 内のすべてのテストを実行することのみをサポートします。残念ながら、このメカニズムでは呼び出し元が独自のテストケースのライフサイクルを制御できないため、tradefed 構成フレームワークでテストケースにオプションを挿入するなどの操作を行うことができません。

パラメータ
result TestResult

run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

テストを実行し、結果をリスナーに報告します。

パラメータ
testInfo TestInformation: テストの実行に役立つ情報を含む TestInformation オブジェクト。

listener ITestInvocationListener: テスト結果の ITestInvocationListener

例外
DeviceNotAvailableException

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

テスト収集モードを有効または無効にします

setDevice

public void setDevice (ITestDevice device)

テスト対象デバイスを挿入します。

パラメータ
device ITestDevice: 使用する ITestDevice