0

android.test.InstrumentationTestRunnerを拡張するテストランナーを作成しました。一連の構成に基づいて実行される一連のテストを定義する方法を探しています。

以下のメソッドをオーバーライドしてカスタムテストスイートを返すことができるかもしれないと思いましたが、これらは呼び出されません!これらの使用は何であるか疑問に思っています:

public TestSuite getAllTests()public TestSuite getTestSuite()

手がかりはありますか?実行時にカスタムテストスイートを定義するために使用できる他の選択肢はありますか?

ありがとう

4

1 に答える 1

0

私も知りません... 別の解決策は、独自の注釈を定義し、実行するテストに注釈を付けることです。次に、次を使用して、その注釈を使用してテストのみを実行できます。

テストの実行を特定のアノテーションでテストにフィルターします: adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.test.InstrumentationTestRunner

他のオプションと一緒に使用すると、結果のテスト実行には 2 つのオプションの和集合が含まれます。たとえば、「-e size large -e annotation com.android.foo.MyAnnotation」は、LargeTest と「com.android.foo.MyAnnotation」アノテーションの両方を使用したテストのみを実行します。

テスト実行を、指定されたアノテーションのないテストにフィルターします: adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation com.android.foo/android.test.InstrumentationTestRunner

于 2011-03-22T11:03:15.820 に答える