1

一切都编译得很好,但是当我运行我的 android 测试时,在项目类被实例化的地方出现错误。例子:

package com.lognllc.plyfe.model;

import android.test.InstrumentationTestCase;
import com.lognllc.plyfe.model.PlyfeModel;


public class PlyfeModelTest extends InstrumentationTestCase {
    private PlyfeModel model;

    @Override
    protected void setUp() {
        model = new PlyfeModel();
    }

    public void testSet() {
        assertTrue(true);
    }
}

当我构建并运行测试时,我得到:

test:

 [echo] Running tests ...
 [exec] 
 [exec] com.lognllc.plyfe.model.PlyfeModelTest:
 [exec] Error in testSet:
 [exec] java.lang.NoClassDefFoundError: com.lognllc.plyfe.model.PlyfeModel
 [exec]     at com.lognllc.plyfe.model.PlyfeModelTest.setUp(PlyfeModelTest.java:12)
 [exec]     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
 [exec]     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
 [exec]     at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
 [exec]     at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
 [exec] 
 [exec] com.lognllc.plyfe.ui.SplashActivityTest:.
 [exec] Test results for InstrumentationTestRunner=.E.
 [exec] Time: 0.019
 [exec] 
 [exec] FAILURES!!!
 [exec] Tests run: 2,  Failures: 0,  Errors: 1
 [exec] 
 [exec] 

我可以让测试在 Eclipse 中运行,但不能从 ant 中运行。它把我逼上一堵墙,我希望这是一个简单的解决方法,我只是犯了一些 n00b 错误。

4

0 回答 0