小编Dom*_*erg的帖子

IntentService的Android ServiceTestCase

我目前正在为Android应用程序编写单元测试,并偶然发现了以下问题:

我用它ServiceTestCase来测试IntentService这样的:

@Override
public void setUp() throws Exception {
    super.setUp();      
}

public void testService()
{
    Intent intent = new Intent(getSystemContext(), MyIntentService.class);
    super.startService(intent);     
    assertNotNull(getService());        
}
Run Code Online (Sandbox Code Playgroud)

但是我注意到我IntentService的创建(意味着onCreate被调用),但我从未接到过调用onHandleIntent(Intent intent)

有人已经IntentServiceServiceTestCase课堂上测试了吗?

谢谢!

android servicetestcase

11
推荐指数
2
解决办法
5201
查看次数

标签 统计

android ×1

servicetestcase ×1