LocalServiceTestpublic class LocalServiceTest extends android.test.ServiceTestCase This is a simple framework for a test of a Service. See {@link android.test.ServiceTestCase
ServiceTestCase} for more information on how to write and extend service tests.
To run this test, you can type:
adb shell am instrument -w \
-e class com.example.android.apis.app.LocalServiceTest \
com.example.android.apis.tests/android.test.InstrumentationTestRunner |
Constructors Summary |
---|
public LocalServiceTest()
super(LocalService.class);
|
Methods Summary |
---|
protected void | setUp()
super.setUp();
| public void | testBindable()Test binding to service
Intent startIntent = new Intent();
startIntent.setClass(getContext(), LocalService.class);
IBinder service = bindService(startIntent);
| public void | testPreconditions()The name 'test preconditions' is a convention to signal that if this
test doesn't pass, the test case was not set up properly and it might
explain any and all failures in other tests. This is not guaranteed
to run before other tests, as junit uses reflection to find the tests.
| public void | testStartable()Test basic startup/shutdown of Service
Intent startIntent = new Intent();
startIntent.setClass(getContext(), LocalService.class);
startService(startIntent);
|
|