Androidで作成した電卓アプリのテストがどうしても失敗してしまう.
CalculatorTest
java
1@RunWith(AndroidJUnit4.class) 2@LargeTest 3public class CalculatorTest { 4 5 @Rule 6 public ActivityTestRule<Calculator> mActivityRule = 7 new ActivityTestRule<>(Calculator.class); 8 9 @Test 10 public void test1() { 11 onView(withId(R.id.b2)).perform(click()).check(matches(isDisplayed())); 12 onView(withId(R.id.badd)).perform(click()).check(matches(isDisplayed())); 13 onView(withId(R.id.b3)).perform(click()).check(matches(isDisplayed())); 14 onView(withId(R.id.beq)).perform(click()).check(matches(isDisplayed())); 15 onView(withId(R.id.resultText)).check(matches(withText("5"))); 16 } 17}
build.gradle
java
1android { 2 compileSdkVersion 28 3 defaultConfig { 4 applicationId "com.example.ooooooo.calculator" 5 minSdkVersion 15 6 targetSdkVersion 28 7 versionCode 1 8 versionName "1.0" 9 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 10 } 11 buildTypes { 12 release { 13 minifyEnabled true 14 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 15 } 16 } 17} 18 19dependencies { 20 implementation fileTree(dir: 'libs', include: ['*.jar']) 21 implementation 'com.android.support:appcompat-v7:28.0.0' 22 implementation 'com.android.support.constraint:constraint-layout:1.1.3' 23 testImplementation 'junit:junit:4.12' 24 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' 25 androidTestImplementation 'androidx.test:runner:1.1.0' 26 androidTestImplementation 'androidx.test:rules:1.1.0' 27}
実行すると以下のように出る.
Test running failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException' Empty test suite.
何をすればいいのか全く分かりません.
アドバイスお願いします.
あなたの回答
tips
プレビュー