From: wang x. <xin...@gm...> - 2013-07-23 10:17:10
|
Hi all, Forgive me if this question is duplicate. Today I tried to use cobertura to measure the test code coverage of my Android app. I've two test cases code for two java files. The first java code has no Android API, so the test case runs fine, and can generate the code coverage. However, the second java code has Android API used, so the second test case failed to run. The error is as below: <error type="java.lang.NoClassDefFoundError" message="android/content/pm/PackageManager$NameNotFoundException"> java.lang.NoClassDefFoundError: android/content/pm/PackageManager$NameNotFoundException at com.test.MyUtilityTest.testupdateGLDCurrentOpenConversationItem2(MyUtilityTest.java:90) Caused by: java.lang.ClassNotFoundException: android.content.pm.PackageManager$NameNotFoundException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) </error> Could someone tell me how to use cobertura to measure code coverage with Android? Thanks a lot. |
From: Steven C. <sch...@gm...> - 2013-07-23 10:57:40
|
This is actually a bug in the latest version of cobertura, see: https://github.com/cobertura/cobertura/issues/49 Thanks, Steve. On 07/23/2013 05:16 AM, wang xinyu wrote: > Hi all, > > Forgive me if this question is duplicate. Today I tried to use > cobertura to measure the test code coverage of my Android app. I've > two test cases code for two java files. The first java code has no > Android API, so the test case runs fine, and can generate the code > coverage. However, the second java code has Android API used, so the > second test case failed to run. The error is as below: > > <error type="java.lang.NoClassDefFoundError" > message="android/content/pm/PackageManager$NameNotFoundException"> > java.lang.NoClassDefFoundError: > android/content/pm/PackageManager$NameNotFoundException at > com.test.MyUtilityTest.testupdateGLDCurrentOpenConversationItem2(MyUtilityTest.java:90) > > Caused by: java.lang.ClassNotFoundException: > android.content.pm.PackageManager$NameNotFoundException > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > </error> > > Could someone tell me how to use cobertura to measure code coverage > with Android? Thanks a lot. > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > > > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
From: wang x. <xin...@gm...> - 2013-07-23 11:42:57
|
Hi Steven, Thanks for your reply. I've checked the link you suggested. However, I think the issue in that link and the error that I encounter are different. The error in the issue is ClassNotFoundException, while the error that I see is NoClassDefFoundError. BTW, I do see the error of ClassNotFoundException with latest cobertura library, but I can still run most of my test case. 2013/7/23 Steven Christou <sch...@gm...> > This is actually a bug in the latest version of cobertura, see: > https://github.com/cobertura/cobertura/issues/49 > > Thanks, > Steve. > > > On 07/23/2013 05:16 AM, wang xinyu wrote: > > Hi all, > > Forgive me if this question is duplicate. Today I tried to use cobertura > to measure the test code coverage of my Android app. I've two test cases > code for two java files. The first java code has no Android API, so the > test case runs fine, and can generate the code coverage. However, the > second java code has Android API used, so the second test case failed to > run. The error is as below: > > <error type="java.lang.NoClassDefFoundError" > message="android/content/pm/PackageManager$NameNotFoundException"> > java.lang.NoClassDefFoundError: > android/content/pm/PackageManager$NameNotFoundException at > com.test.MyUtilityTest.testupdateGLDCurrentOpenConversationItem2(MyUtilityTest.java:90) > Caused by: java.lang.ClassNotFoundException: > android.content.pm.PackageManager$NameNotFoundException > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > </error> > > Could someone tell me how to use cobertura to measure code coverage with > Android? Thanks a lot. > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today!http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > > > > _______________________________________________ > Cobertura-devel mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > > |