Trying to learn instrumentation testing scenarios. While going over the relevant documentation for the ActivityInstrumentationTestCase2
, i learned that we can use the ActivityInstrumentationTestCase2
in conjunction with Espresso
to write so called "functional" tests. Or at least that is what i understood from the relevant documentation.
However i ran into something called a ActivityUnitTestCase
and a ServiceTestCase
, which i had never heard of before. Trying to figure that out led me down a wild goose chase and now i am terribly lost here with so many verbiages to the whole Android testing paradigm.
Considering from a high level that Android testing broadly falls into two buckets:
Unit testing
andfunctional testing
. Out of the following, which falls under which.JUnit
,JUnit4
,TestCase
,AndroidTestCase
,ActivityInstrumentationTestCase2
,ServiceTestCase
,ApplicationTestCase
,AndroidTestRunner
,AndroidJUnitRunner
,AndroidJUnit4
What should be used when?
Do any of them relate to the actual Unit testing (by which i mean POJO testing). I ask this because i have noticed some tutorial links in which the sample test case extends
JUnit4
/TestCase
and is still termed a unit test whereas one of the links below does not extend anything at all and still works as a simplePOJO
test case. Which raises the question what exactly is the difference between aJUnit4
and simplePOJO
test class.
References that i have checked so far:
http://www.vogella.com/tutorials/AndroidTesting/article.html#androidtesting_creatingtestfolders
https://shaun.church/unit-testing-java-classes-in-android-studio/
Robolectric vs Android Test Framework
http://developer.android.com/tools/testing/testing_android.html
Any ideas, tips much appreciated. Thanks!