Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences in the varies Android test case classes?

What are the differences in the varies Android test case classes? That are more than 10 classes in the android.test package that end with "TestCase".

The difference between AcitivtyTestCase and ServiceTestCase is trivial. But what's the difference between ActivityTestCase, ActivityInstrumentationTestCase, and ActivityUnitTestCase?

like image 362
ming_codes Avatar asked Nov 04 '22 15:11

ming_codes


1 Answers

Typically you do not use the ActivityTestCase class its existence is mostly so that ActivityInstrumentationTestCase (do not use this, it is deprecated), ActivityInstrumentationTestCase2 and ActivityUnitTestCase can inherit useful common functionality from.

From there the difference is mostly down to what sort of testing you want to do. Functional/Integration testing is best done within ActivityInstrumentationTestCase2 while unit testing of an activity is from ActivityUnitTestCase. The difference is mostly down to the methods available in the classes and typically with android being open source any method you want from one that isn't in the other (I have never had this) you can just go and get and probably add yourself.

like image 121
Paul Harris Avatar answered Nov 10 '22 15:11

Paul Harris