我正在尝试使用IdlingResources在网络调用完成后测试某些内容。 我在我的主Activity中有一个CountingIdlingResource来跟踪正在运行的作业,但我的测试文件无法识别getIdlingResource:
这里是我的导入语句:
package com.example.android.bakingapp;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.example.android.bakingapp.activities.MainActivity;
import com.example.android.bakingapp.activities.RecipeActivity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
我在Gradle依赖项中也包含了这个:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
MainActivity
是否实际上有一个名为getIdlingResource()
的方法,用于返回空闲资源? - dominicoder