From: Piotr T. <pi...@ta...> - 2011-10-19 16:10:53
|
Hi, I think that you must force your application to dump the state before it will exit: Try calling something like that: try { String className = "net.sourceforge.cobertura.coveragedata.ProjectData"; String methodName = "saveGlobalProjectData"; Class saveClass = Class.forName(className); java.lang.reflect.Method saveMethod = saveClass.getDeclaredMethod(methodName, new Class[0]); saveMethod.invoke(null,new Object[0]); } catch (Throwable t) { } Just before you application exit... Maybe in the last unit test (I know - it is hacky) . Piotr 2011/10/9 Pu Gong <pu...@gm...> > Hi guys, > I am trying to get the coverage number of my Android project tests. I did > the following things to make the instrumented class can run on Android > without any Java exception, but I couldn't get the cobertura.ser file. > Anyone can tell me how to make Cobertura support Android. > 1. Set the data file output path in run time by calling the > System.setProperty. > 2. Instrument all .class file of the Android apk project > 3. Package all .class, coberatura.jar and all dependent jars. log4j.jar > is replaced by slf4j. > 4. Install the apk. > 5. Install the test apk and run. Since on Android an application doesn't > quit by user pressing Back/Home button, I use the test apk to make the app > quit. The system will exit the app process after the junit tests finish. > After I run the junit test, I didn't get any data file (.ser file). > > Thanks a lot. > -G.P > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2dcopy2 > _______________________________________________ > Cobertura-devel mailing list > Cob...@li... > https://lists.sourceforge.net/lists/listinfo/cobertura-devel > > -- Pozdrawiam, Piotr Tabor |