无法使用导入android.support.test.rule.ActivityTestRule

时间:2019-02-04 08:58:15

标签: android unit-testing testing automated-tests qa

我该如何解决这个问题:

在线 “导入android.support.test.rule.ActivityTestRule;”  “规则”一词为红色

以及“ ActivityTestRule”这两个字也是红色

public ActivityTestRule mActivityRule =新的ActivityTestRule(AuthorizationPresenter.class);

package by.hjhj;

import android.support.test.espresso.NoMatchingViewException;
import android.support.test.rule.ActivityTestRule;



import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;


import by.belinvestbank.presenter.authorization.AuthorizationPresenter;

public class Authorization {

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

    @Before
    public void SetUp()throws Exception{
        Thread.sleep(4000);
        try {
            onView(allOf(withId(R.id.login),(isDisplayed()))).check(matches(isDisplayed()));
        }
        catch (NoMatchingViewException e) {
            pressBack();

        }
    }
}

0 个答案:

没有答案