public class TestService extends ServiceTestCase<TService> {
public TestService() {
super(TService.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@SmallTest
public void testPreconditions() {
}
/**
* Test basic startup/shutdown of Service
*/
@SmallTest
public void testStartable() {
Intent startIntent = new Intent();
startIntent.setClass(getContext(), Test1Activity.class);
startService(startIntent);
}
/**
* Test binding to service
*/
@MediumTest
public void testBindable() {
Intent startIntent = new Intent();
startIntent.setClass(getContext(), Test1Activity.class);
bindService(startIntent);
}
}
ndroid junit入门(四)Service测试
最新推荐文章于 2025-05-09 12:37:27 发布
本文介绍了一个测试案例,用于验证Android Service的基本启动和关闭过程,以及如何实现与Service的绑定。通过创建TestService类,使用不同的测试注解来区分测试级别。
1936

被折叠的 条评论
为什么被折叠?



