我编写了一些测试,并希望使用 IntelliJ 插件获得代码覆盖率! 我的测试代码:
public class TestLogin extends ActivityInstrumentationTestCase2<ActivityAccounting> {
private Solo solo;
public TestLogin() {
super(ActivityAccounting.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
solo = new Solo(this.getInstrumentation(), getActivity());
}
@Test
public void testLoginClick() throws Exception {
//Some UI test
}
}
在 EditConfiguration
中,我添加了一个 Junit 测试:
但是当我运行覆盖范围时,我编写了以下错误代码:
我该怎么办? 提前tnx。
最佳答案
如果您在 build.gradle 中配置了所有内容,如下所示:
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.jayway.android.robotium:robotium-solo:5.6.0'
compile 'com.android.support:support-annotations:23.0.0'
//....
//....
}
您只需在测试类中单击鼠标右键并选择“运行”即可运行测试
关于android - Android studio 中的空测试套件运行测试并覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38719110/