Android单元测试研究与实践(11)
Activity跳转是Android开发的重要逻辑,其 测试方法 如下: ahref= http://www.jobbole.com/members/madao @Test/a public voidtestActivityTurn(ActionBarActivityfirstActivity,ClasssecondAct
Activity跳转是Android开发的重要逻辑,其测试方法如下:
-
<a href="http://www.jobbole.com/members/madao">@Test</a>
-
-
public void testActivityTurn(ActionBarActivity firstActivity, Class secondActivity) {
-
-
Intent intent = new Intent(firstActivity.getApplicationContext(), secondActivity);
-
-
assertEquals(intent, Robolectric.shadowOf(firstActivity).getNextStartedActivity());//3.0的API与2.4不同
-
原文转自:http://tech.meituan.com/Android_unit_test.html