2016-08-02 162 views
2

我编写了一些测试,并希望获得IntelliJ Plugin的代码覆盖率! 我的测试代码:Android Studio中的空测试套件运行覆盖测试

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测试:

enter image description here

但是,当我与覆盖我的代码运行如下错误:

enter image description here

什么我应该怎么做? tnx提前。

回答

0

如果你已经在正确配置的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' 
    //.... 
    //.... 
} 

你只需要通过点击测试类鼠标右键按钮并选择运行

+0

我运行测试添加此依赖关系之前,也是我的测试运行良好,但我无法获得测试代码覆盖率!你有什么主意吗? –

+0

您是否将它作为JUnit测试运行? –

+0

是的。我在EditConfiguration中添加一个名为“Unnamed”的junit测试,并运行此JUnit测试。 –

相关问题