iRavi iVooda iRavi iVooda - 1 month ago 16
Android Question

Android New Test Type

In Android test framework there are two types namely,

Local unit tests
and
Instrumented tests
. Is it possible to create duplicate of the Instrumented tests?

I want only some tests to be executed when I select the this duplicate. Or in other words I wanna distinguish between different tests in "Instrumented Tests". Is this possible?

Please ask for any details you need. Thanks.

Answer

There's no need to duplicate tests, you can just annotate them using some of the Android Testing Support Library provided filters or you can create you own annotation.

Then using AndroidJunitRunner you can run tests with or without a particular annotation

Filter test run to tests with given annotation:

adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
Comments