Test activity that is in AndroidManifest tests

I need to check Activity (view in it, to be more specific). But I cannot test it correctly because it binds to a service that affects my tests. So I want to create a test activity that extends the original activity with an overridden bindService. The problem is I don't want to put this test activity in the main AndroidManifest.xml. I want to store it in ... /tests/AndroidManifest.xml. But after that I get an exception every time I call getActivity in my

public class MyTest extends ActivityInstrumentationTestCase2<TestActivity>

      

It says:

java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.ascom.example/.test.TestActivity }

      

So the question is: can this trick be implemented?

+3


source to share





All Articles