2013-02-12 89 views
1

我試圖測試一個活動,包括來自android-annotations 2.7的註釋,比如@EActivity,@ViewById等。每個測試都會因爲NoClassDefFoundError而失敗。有沒有人有一個工作示例如何將Robotium與Android Annotations結合使用? 這裏是我的測試案例:robotium和android註釋

package de.abc.view; 

import android.test.ActivityInstrumentationTestCase2; 
import android.widget.Button; 

import com.jayway.android.robotium.solo.Solo; 

import de.abc.R; 

public class WorktimeActivityTest extends ActivityInstrumentationTestCase2<WorktimeActivity_>{ 

    private Solo solo; 

    public WorktimeActivityTest() { 
     super(WorktimeActivity_.class); 
    } 

    public void setUp() throws Exception{ 
     solo = new Solo(getInstrumentation(), getActivity()); 
    } 

    public void testSelectWorkday() { 
     Button button = (Button) solo.getView(R.id.selectWorkday); 
     solo.clickOnView(button); 
    } 

    @Override 
    public void tearDown() throws Exception{ 
     solo.finishOpenedActivities(); 
    } 


} 
+0

它調用它找不到? – 2013-02-15 06:48:59

+0

看看:http://stackoverflow.com/questions/14076694/classnotfoundexception-using-androidannotations – 2013-02-15 06:52:35

回答

0

我發現我的錯誤。無法找到的類未包含在構建路徑中。所以我不得不改變我的構建路徑,幷包括從android-annotations生成的來源...愚蠢的錯誤...