Robolectric_配置时cannot find class 'org.junit.Test' on project build path的问题

来源:互联网 发布:jsp网上报修系统源码 编辑:程序博客网 时间:2024/06/05 11:15

解决方法:

ake sure your eclipse environment is using JUnit 4. JUnit 3 doesn't make use of annotations (it uses the oldextends TestCase style)

There are few things to double check:

Window > Preferences > Java > JUnit

Are you seeing junit4 or junit3 imports? If that looks good, make sure the project itself is using JUnit4 instead of JUnit3.

Right Click on project > Properties > Java Build Path > Libraries

Is JUnit4 included there? Is anything JUnit related there? If JUnit3 is in there, click on it and clickRemove. Then click Add Library... and follow the prompts from there to add JUnit again.

Out of curiosity, are the JUnits run outside of eclipse? Like with a mvn install or whatever build target you have for Ant that'll run JUni