2016-08-02 166 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測試。 –

相關問題