【问题标题】:IllegalStateException in Roboelectric with SupportFragmentTestUtil.startVisibleFragment(myFragment)带有 SupportFragmentTestUtil.startVisibleFragment(myFragment) 的 Roboelectric 中的 IllegalStateException
【发布时间】:2020-03-11 15:14:55
【问题描述】:

我正在设置这个类来测试我的片段:

@RunWith(RobolectricTestRunner.class)
public class MyFragmentTest {

    MyFragment myFragment;

    @Before
    public void setUp(){
        myFragment = (MyFragment)FmyFragment.instantiate(ApplicationProvider.getApplicationContext(), MyFragment.class.getName());
        SupportFragmentTestUtil.startVisibleFragment(myFragment);
    }

}

但是行

SupportFragmentTestUtil.startVisibleFragment(myFragment);

正在抛出以下异常:

java.lang.IllegalStateException: Recursive entry to executePendingTransactions

我是否错过了设置中的某些内容?我已经尝试了很多东西,这是我最接近使用 roboelectric 开始我的片段的一次。

如果您需要更多信息,请随时询问。

【问题讨论】:

    标签: java android testing junit robolectric


    【解决方案1】:

    问题出在使用 roboelectric 时出现 Glide Bug。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2016-06-15
      • 2014-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多