测试无法完成。原因:“测试运行无法完成。预期有1个测试,收到0'。检查设备日志以获得详细信息

编译代码,然后从项目开始运行测试,然后失败。

我在这里用gradle,junit,espresso

public class ExampleInstrumentedTest {

    public ExampleInstrumentedTest() {

    }

    @ClassRule
    public static DeviceAnimationTestRule
            deviceAnimationTestRule = new DeviceAnimationTestRule();
    @Rule
    public ActivityTestRule<My_Activity> mLoginActivityTestRule =
            new ActivityTestRule<My_Activity>(My_Activity.class);
    @Rule
    public UiThreadTestRule uiThreadTestRule = new UiThreadTestRule();

 @Test
    public void CreateAndSaveTaskEntity() throws Throwable {

        uiThreadTestRule.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                com.falah.eats.view.base.screen.SplashScreen activity = mLoginActivityTestRule.getActivity();
                activity.getWindow()
                        .addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
                                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
            }
        });


    }
评论