空的测试套件。Espresso

5

我是自动化测试的新手。尽管我有测试套件,但我想运行特定的测试类,它给我的输出为:

"客户端尚未准备好..测试运行已开始... 测试运行完成...空测试套件.."

我已经搜索并找到了许多解决方案,但它们都没有对我起作用。如果能得到任何帮助,我将不胜感激。这是测试文件。

 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'
}

试一下这个 --> https://dev59.com/Kl0a5IYBdhLWcg3wzbYU#30172064 - vk.4884
我也尝试过了,但是对我没用。 - Riddhi Daftary
请注意检查构建变体。 - jeprubio
构建变体为debug。 - Riddhi Daftary
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接