繁体   English   中英

空的测试套件。 浓咖啡

[英]Empty test suite. espresso

我是自动化测试的新手。 我想运行一个特定的测试类,即使我有测试套件,它也会输出为

“客户还没准备好......测试运行开始......测试完成了......空测试套件......”

我搜索过并发现了很多解决方案。 但他们都没有为我工作。 如果我能得到任何帮助,我将不胜感激。 这是测试文件。

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

尝试在Edit Configuration手动制作新的Android Instrumented Tests Edit Configuration https://stackoverflow.com/a/53715513/967131

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM