我是自动化测试的新手。即使我有测试套件,我也想运行一个特定的测试类,它给我的输出为
“客户端尚未准备好......测试运行开始......测试运行完成......空测试套件......”
我也搜索并找到了许多解决方案。但没有一个对我有用。如果我在这方面得到任何帮助,我将不胜感激。这是测试文件。
package com.smsbits.veridoc.activity;
@RunWith(AndroidJUnit4.class)
public class TempActivityEspressoTest {
public Resources resources;
@Rule
public ActivityTestRule mActivityRule = new ActivityTestRule<>(TempActivity.class);
@Before
public void init() {
resources = mActivityRule.getActivity().getResources();
}
@Test
public void testCheckInputs() {
onView(withId(R.id.btnchange)).perform(click());
onView(withId(R.id.tvrandom)).check(ViewAssertions.matches(withText("hello")));
}}
这是我的 gradle 文件。
android {
...
packagingOptions {
...
exclude 'META-INF/XXX'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
}
defaultConfig {
...
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
testOptions {
unitTests.returnDefaultValues = true
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
}
}
dependencies{
...
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile "org.robolectric:robolectric:3.0"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'javax.inject'
})
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2' //intents support
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}