1.As點擊運行測試用例:
2.運行起來后,將要運行的流程,整個點擊一遍
3.生成Test類,可直接運行
4.修改內部代碼
1)
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction relativeLayout = onView(
allOf(withId(R.id.is_course_list_btn_activity_layout), isDisplayed()));
relativeLayout.perform(click());
sleep時間可以盡可能短點(500,多的1500),點擊事件的id后邊最好不要加parent.
2)
ViewInteraction editText2 = onView(
allOf(withId(R.id.act_show_create_title_et),
withParent(withId(R.id.act_show_create_content_ll))));
editText2.perform(scrollTo(), replaceText("王靜靜靜靜靜"), closeSoftKeyboard());
perform調一次設置值就可以了,把多余的刪掉。
3)list:從相冊選取照片,顯示
ViewInteraction imageView2 = onView(
allOf(withId(R.id.image_view),
childAtPosition(
childAtPosition(
withId(R.id.myGrid),
0),
0),
isDisplayed()));
imageView2.perform(click());
4.點擊運行
5.備注:可運行monitor.exe找id,還有parent關系