1
沒有這樣的清單文件:建立/中間體/包/調試/應用/ src目錄/主/ AndroidManifest.xml中使用Roboletric針對JUnit測試
Refered到 - Robolectric says "AndroidManifest.xml not found"
https://github.com/robolectric/robolectric/issues/1648但沒有任何幫助。
沒有這樣的清單文件:建立/中間體/包/調試/應用/ src目錄/主/ AndroidManifest.xml中使用Roboletric針對JUnit測試
Refered到 - Robolectric says "AndroidManifest.xml not found"
https://github.com/robolectric/robolectric/issues/1648但沒有任何幫助。
檢查gradle這個和你的等級:
搖籃:
testCompile 'org.robolectric:robolectric:3.3'
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:1.7.1'
在您的測試類:
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 25)
public class YourTest {
@Test
public void shouldNotBeNull() throws Exception {
//put your test here for example
}
)
YourTest類應放在測試文件夾(不AndroidTest文件夾)
在Android Studio上:
你把你的測試課放在哪裏?你能打印你的項目結構嗎? –
我的測試類是用app/src/test/java/com.packagename/MainActivityTest編寫的。 –