Robolectric có vẻ là một thử nghiệm ứng dụng android thay thế rất interststing, nhưng tôi không thể tích hợp nó một cách hợp lý với môi trường Eclipse của tôi.Robolectric 2.1 và Eclipse
Sử dụng phiên bản robolectric mới nhất 2.1 và android sdk 8, tôi làm theo các bước thiết lập Eclipse được mô tả trên trang web robolectric nhưng không có may mắn. Khi tôi chạy cấu hình chạy mới được tạo của tôi, kiểm tra được dừng lại sau lỗi.
Tôi không biết chính xác lý do tại sao lớp pakpak .R của tôi không thể tìm thấy và ro.build.date.utc là gì? một triệu chứng hay vấn đề?
WARNING: no system properties value for ro.build.date.utc
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.googlecode.pakpak.android.R
at org.robolectric.AndroidManifest.getRClass(AndroidManifest.java:102)
at org.robolectric.AndroidManifest.getResourcePath(AndroidManifest.java:275)
at org.robolectric.AndroidManifest.getIncludedResourcePaths(AndroidManifest.java:280)
at org.robolectric.AndroidManifest.getIncludedResourcePaths(AndroidManifest.java:282)
at org.robolectric.RobolectricTestRunner.createAppResourceLoader(RobolectricTestRunner.java:590)
at org.robolectric.RobolectricTestRunner.getAppResourceLoader(RobolectricTestRunner.java:582)
at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:66)
at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:392)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:232)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:181)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.googlecode.pakpak.android.R
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at org.robolectric.AndroidManifest.getRClass(AndroidManifest.java:100)
... 24 more
Tại sao bạn không thử dùng Robotium? –
Tôi đã xem xét Robotium và dường như tôi vẫn yêu cầu thiết bị hoặc trình giả lập để chạy thử nghiệm. Trái với điều này, cách tiếp cận của Robolectric chạy các thử nghiệm của bạn trên JVM với tốc độ nhanh hơn nhiều. –
Tôi gặp sự cố chính xác này. Tôi sẽ đăng nếu tôi tìm thấy bất cứ điều gì. – Gowiem