Android 如何使用浓缩咖啡测试碎片?

Android 如何使用浓缩咖啡测试碎片?,android,android-fragments,android-espresso,ui-testing,Android,Android Fragments,Android Espresso,Ui Testing,嗨,我正在试着用浓缩咖啡测试碎片。我在一个活动中有两个按钮,我在单击按钮的同时替换片段。我的XML如下 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_pare

嗨,我正在试着用浓缩咖啡测试碎片。我在一个活动中有两个按钮,我在单击按钮的同时替换片段。我的XML如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Fragment No.1"
        android:onClick="selectFrag" />

    <Button
        android:id="@+id/button2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="selectFrag"
        android:text="Fragment No.2" />

    <fragment
        android:name="com.example.admin1.espressotestingsample.fragment.FragmentOne"
        android:id="@+id/fragment_place"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>
我的测试用例如下

 @Rule
    public ActivityTestRule<ActivityFragment> testRule =
            new ActivityTestRule<>(ActivityFragment.class);

    @Before
    public void init(){
        testRule.getActivity()
                .getSupportFragmentManager().beginTransaction();
    }

@Test
public void testSecondFragment() {  
  onView(withId(R.id.button2)).perform(click());
  onView(allOf(withId(R.id.fragment_textview_two),withEffectiveVisibility(VISIBLE))).
check(matches(isDisplayed()));
}
但是当我运行这个测试时,我得到了以下错误

@Test
public void testFirstFragment() {  
  onView(withId(R.id.button1)).perform(click());
  onView(allOf(withId(R.id.fragment_textview_one),withEffectiveVisibility(VISIBLE))).
check(matches(isDisplayed()));
}
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: com.example.admin1.espressotestingsample:id/fragment_textview_one and view has effective visibility=VISIBLE)' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.

View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302f8
fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1794, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@704500d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-->ViewStub{id=16908682, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4483bc2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+-->FrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1080, height=1731, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e334d10, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=63.0, child-count=1}
|
+--->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1731, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@9682a3c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+---->Button{id=2131165220, res-name=button1, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4a073c5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Fragment No.1, input-type=0, ime-target=true, has-links=false}
|
+---->Button{id=2131165221, res-name=button2, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@af5811a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=126.0, text=Fragment No.2, input-type=0, ime-target=false, has-links=false}
|
+---->ConstraintLayout{id=2131165244, res-name=fragment_place, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e5a94e6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=252.0, child-count=4}
|
+----->TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@5d3aa27, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+----->Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@a2184d4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+----->ConstraintLayout{id=-1, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@bab1972, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+------>TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@9c6c1c3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+------>Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@87c1a40, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+----->ConstraintLayout{id=-1, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@30d5abe, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+------>TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@b49b71f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+------>Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@5289a6c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+->View{id=16908336, res-name=navigationBarBackground, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@cded835, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=1794.0}
|
+->View{id=16908335, res-name=statusBarBackground, visibility=VISIBLE, width=1080, height=63, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@ec064ca, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1538)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:88)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:51)
at android.support.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:312)
at android.support.test.espresso.ViewInteraction.check(ViewInteraction.java:297)
at com.example.admin1.espressotestingsample.FragmentTest.testSecondFragment(FragmentTest.java:67)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at android.support.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)...

我很困惑。第一个代码正在运行。但第二个代码不起作用。请让我知道原因,并帮助我测试碎片。因为我的整个项目只构建了片段。

您的测试抛出了
AmbigousViewMatcherException
,因为它找到了3个id为(R.id.fragment\u textview\u one)的相同匹配器
,具有有效可见性(可见))
,这意味着创建了3个
FragmentOne

在活动XML布局中,更改以下内容中的
片段

<fragment
    android:name="com.example.admin1.espressotestingsample.fragment.FragmentOne"
    android:id="@+id/fragment_place"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

我不确定第三个片段,但您不需要调用
testRule.getActivity().getSupportFragmentManager().beginTransaction()
,尤其是当您在测试中没有使用它时。

您在测试中指定的大多数视图在代码中都不可见。但是testSecondFragment()工作正常。还有,请告诉我其他方法或教程?我的意思是你应该发布那些id引用的代码。@DevMike。。我也添加了我的两个XML片段。请检查并告知我是否有任何错误。@NewDeveloper您确定共享了正确的fragment one XML布局吗?它在错误日志中看起来不同-视图的数量不正确。为什么要在
init
中开始片段事务?更改为FramLayout后,代码工作正常。
@Test
public void testFirstFragment() {  
  onView(withId(R.id.button1)).perform(click());
  onView(allOf(withId(R.id.fragment_textview_one),withEffectiveVisibility(VISIBLE))).
check(matches(isDisplayed()));
}
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: com.example.admin1.espressotestingsample:id/fragment_textview_one and view has effective visibility=VISIBLE)' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.

View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302f8
fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1794, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@704500d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-->ViewStub{id=16908682, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4483bc2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+-->FrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1080, height=1731, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e334d10, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=63.0, child-count=1}
|
+--->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1731, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@9682a3c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+---->Button{id=2131165220, res-name=button1, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4a073c5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Fragment No.1, input-type=0, ime-target=true, has-links=false}
|
+---->Button{id=2131165221, res-name=button2, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@af5811a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=126.0, text=Fragment No.2, input-type=0, ime-target=false, has-links=false}
|
+---->ConstraintLayout{id=2131165244, res-name=fragment_place, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e5a94e6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=252.0, child-count=4}
|
+----->TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@5d3aa27, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+----->Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@a2184d4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+----->ConstraintLayout{id=-1, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@bab1972, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+------>TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@9c6c1c3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+------>Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@87c1a40, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+----->ConstraintLayout{id=-1, visibility=VISIBLE, width=1080, height=1479, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@30d5abe, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+------>TextView{id=2131165245, res-name=fragment_textview_one, visibility=VISIBLE, width=479, height=100, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@b49b71f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=690.0, text=First Fragment, input-type=0, ime-target=false, has-links=false} ****MATCHES****
|
+------>Button{id=2131165242, res-name=fragment_button_one, visibility=VISIBLE, width=286, height=126, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.support.constraint.ConstraintLayout$LayoutParams@5289a6c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Button One, input-type=0, ime-target=false, has-links=false}
|
+->View{id=16908336, res-name=navigationBarBackground, visibility=VISIBLE, width=1080, height=126, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@cded835, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=1794.0}
|
+->View{id=16908335, res-name=statusBarBackground, visibility=VISIBLE, width=1080, height=63, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@ec064ca, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1538)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:88)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:51)
at android.support.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:312)
at android.support.test.espresso.ViewInteraction.check(ViewInteraction.java:297)
at com.example.admin1.espressotestingsample.FragmentTest.testSecondFragment(FragmentTest.java:67)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at android.support.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)...
<fragment
    android:name="com.example.admin1.espressotestingsample.fragment.FragmentOne"
    android:id="@+id/fragment_place"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
<FrameLayout
    android:name="com.example.admin1.espressotestingsample.fragment.FragmentOne"
    android:id="@+id/fragment_place"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />