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 mExcludeAnnotation

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

protected mExcludeFilters

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

protected mIncludeAnnotation

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

protected mIncludeFilters

実行するテスト名の包含フィルタ

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

DeviceTestCase()
DeviceTestCase(String name)

パブリック メソッド

void addAllExcludeAnnotation( notAnnotations)

テストにマークが付いている場合に除外するアノテーションの ERROR(/Set) を追加。

void addAllExcludeFilters( filters)

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

void addAllIncludeAnnotation( annotations)

テストにマークが付いている場合に含めるアノテーションの ERROR(/Set) を追加。

void addAllIncludeFilters( filters)

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

void addExcludeAnnotation(String notAnnotation)

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

void addExcludeFilter(String filter)

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

void addIncludeAnnotation(String annotation)

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

void addIncludeFilter(String filter)

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

void clearExcludeAnnotations()

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

void clearExcludeFilters()

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

void clearIncludeAnnotations()

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

void clearIncludeFilters()

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

int countTestCases()
ITestDevice getDevice()

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

getExcludeAnnotations()

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

getExcludeFilters()

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

getIncludeAnnotations()

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

getIncludeFilters()

包含フィルタの現在の ERROR(/Set) を返します。

void run(TestResult result)

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

void run(TestInformation testInfo, ITestInvocationListener listener)

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

void setCollectTestsOnly(boolean shouldCollectTest)

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

void setDevice(ITestDevice device)

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

フィールド

mExcludeAnnotation

protected  mExcludeAnnotation

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

mExcludeFilters

protected  mExcludeFilters

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

mIncludeAnnotation

protected  mIncludeAnnotation

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

mIncludeFilters

protected  mIncludeFilters

実行するテスト名の包含フィルタ

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

DeviceTestCase

public DeviceTestCase ()

DeviceTestCase

public DeviceTestCase (String name)

パラメータ
name String

パブリック メソッド

addAllExcludeAnnotation

public void addAllExcludeAnnotation ( notAnnotations)

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

パラメータ
notAnnotations

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

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

パラメータ
filters

addAllIncludeAnnotation

public void addAllIncludeAnnotation ( annotations)

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

パラメータ
annotations

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

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

パラメータ
filters

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 ()

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

clearIncludeFilters

public void clearIncludeFilters ()

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

countTestCases

public int countTestCases ()

戻り値
int

getDevice

public ITestDevice getDevice ()

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

戻り値
ITestDevice ITestDevice

getExcludeAnnotations

public  getExcludeAnnotations ()

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

戻り値

getExcludeFilters

public  getExcludeFilters ()

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

戻り値

getIncludeAnnotations

public  getIncludeAnnotations ()

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

戻り値

getIncludeFilters

public  getIncludeFilters ()

包含フィルタの現在の ERROR(/Set) を返します。

戻り値

ホームラン

public void run (TestResult result)

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

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

パラメータ
result TestResult

ホームラン

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