Start a service within a TestCase in android

968 views Asked by At

How to start/bind a service from a test case. I tried using the ServiceTestCase it doesnt work

1

There are 1 answers

0
inazaruk On

From ServiceTestCase documentation:

When one of your test methods calls ServiceTestCase.startService() or ServiceTestCase.bindService(), the test case calls Service.onCreate() and then calls either Service.startService(Intent) or Service.bindService(Intent, ServiceConnection, int), as appropriate. It also stores values needed to track and support the lifecycle.