首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android Slow Motion Automation测试

Android Slow Motion Automation测试
EN

Stack Overflow用户
提问于 2017-04-21 20:08:07
回答 1查看 54关注 0票数 0

嗨,我已经写了自动化测试的代码,它工作得很好,但我需要做这个自动化慢动作,如果这是可能的,请给我任何建议…我在下面提到了我的代码。下面的代码将成功运行,但我需要使用慢动作。

代码语言:javascript
运行
复制
@RunWith(AndroidJUnit4.class)
public class SurveyAutomationTest {

    private String[] Name = new String[]{"prashant", "kiccha"};
    private String[] Phone = new String[] {"9742174495", "1234567890"};
    private String[] Distrcit = new String[]{"Koppal", "Bidar"};
    private String[] Taluk = new String[]{"koppal", "aurad"};
    private String[] Village = new String[]{"agalakera", "aknapur"};
    private String[] Etl1 = new String[]{"1-10","1-10"};
    private String[] Etl2 = new String[]{"20-50","20-50"};
    private String[] Etl3 = new String[]{"11-20","11-20"};
    private String[] Etl4 = new String[]{"20-50","20-50"};
    //private String[] District = new String[] {""};

    @Rule
    public ActivityTestRule<HomeActivity> mActivityRule = new ActivityTestRule<HomeActivity>(HomeActivity.class);

    @Test
    public void homeActivityTest() {

        for (int i = 0; i < 20; i++) {

            Random name = new Random();
            int Rname = name.nextInt(2);

            onView(withId(R.id.setting)).perform(click());

            onView(withId(R.id.connect_printer)).perform(click());

            onView(AllOf.allOf(withText("BTP110-0210\n98:D3:31:B2:82:C5"),isDisplayed())).perform(click());

            onView(withId(R.id.save)).perform(click());

            onView(AllOf.allOf(withId(android.R.id.button1), withText("OK"),isDisplayed())).perform(click());

            onView(withId(R.id.AddfarmerButton)).perform(click());

            onView(withId(R.id.farmernameedit)).perform(typeText(Name[Rname]), closeSoftKeyboard());

            onView(withId(R.id.farmerphnoedit)).perform(typeText(Phone[Rname]), closeSoftKeyboard());


            onView(withId(R.id.districtlist)).perform(click());

            ViewInteraction checkedTextView = onView(allOf(withId(android.R.id.text1), withText(Distrcit[Rname]), isDisplayed()));
            checkedTextView.perform(click());

            ViewInteraction spinner2 = onView(allOf(withId(R.id.taluklist), withParent(allOf(withId(R.id.Taluklayout), withParent(withId(R.id.linearLayout09))))));
            spinner2.perform(scrollTo(), click());

            ViewInteraction checkedTextView2 = onView(allOf(withId(android.R.id.text1), withText(Taluk[Rname]), isDisplayed()));
            checkedTextView2.perform(click());

            ViewInteraction spinner3 = onView(allOf(withId(R.id.villagelist), withParent(allOf(withId(R.id.Villagelayout), withParent(withId(R.id.linearLayout09))))));
            spinner3.perform(scrollTo(), click());

            ViewInteraction checkedTextView3 = onView(allOf(withId(android.R.id.text1), withText(Village[Rname]), isDisplayed()));
            checkedTextView3.perform(click());

            ViewInteraction imageButton3 = onView(allOf(withId(R.id.photo), withParent(allOf(withId(R.id.RelativeLayout16), withParent(withId(R.id.linearLayout3)))), isDisplayed()));
            imageButton3.perform(click());

            onView(withId(R.id.confirm)).perform(click());
EN

回答 1

Stack Overflow用户

发布于 2017-04-21 20:13:40

您可以尝试在调试模式下一步一步地运行测试。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43542333

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档