FileDocCategorySizeDatePackage
LocalServiceTest.javaAPI DocAndroid 1.5 API2581Wed May 06 22:41:08 BST 2009com.example.android.apis.app

LocalServiceTest

public 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

Fields Summary
Constructors Summary
public LocalServiceTest()

      super(LocalService.class);
    
Methods Summary
protected voidsetUp()

        super.setUp();
    
public voidtestBindable()
Test binding to service

        Intent startIntent = new Intent();
        startIntent.setClass(getContext(), LocalService.class);
        IBinder service = bindService(startIntent); 
    
public voidtestPreconditions()
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 voidtestStartable()
Test basic startup/shutdown of Service

        Intent startIntent = new Intent();
        startIntent.setClass(getContext(), LocalService.class);
        startService(startIntent);