JUnit4 – AssertionFailedError:未findtesting

我正在使用AndroidJUnitRunner和Espresso。

我写了一个简单的testing,但总是收到这个exception。 根据Stackoverflow的答案,问题是弄乱了JUnit3和JUnit4,但我从来没有在我的项目中使用JUnit3。

junit.framework.AssertionFailedError:在com.walletsaver.app.test.espresso.SignUpPopupTest中找不到testing

package com.walletsaver.app.test.espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.SmallTest; import com.walletsaver.app.activity.LoginActivity; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.matcher.ViewMatchers.withText; @RunWith(AndroidJUnit4.class) @SmallTest public class SignUpPopupTest { @Rule public ActivityTestRule<LoginActivity> mActivityRule = new ActivityTestRule<>(LoginActivity.class); @Test public void checkSignUpPopup() throws Exception { onView(withText("Sign Up")).perform(click()); } } 

运行configuration: 在这里输入图像说明

输出: 在这里输入图像说明

Solutions Collecting From Web of "JUnit4 – AssertionFailedError:未findtesting"