todoroo / astrid

Astrid: Android's #1 Task Management Application
http://www.astrid.com
GNU General Public License v3.0
1.08k stars 689 forks source link

Failed to generate coverage report for test cases #182

Open davidyoung8906 opened 12 years ago

davidyoung8906 commented 12 years ago

I'm running well with all the test cases with Junit. But when I use "ant coverage" trying to generate test cases report, The error below appears:

[exec] com.todoroo.astrid.dao.TaskDaoTests:.....INSTRUMENTATION_RESULT: shortMsg=java.lang.IllegalStateException [exec] INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalStateException: database /data/data/com.timsu.astrid/databases/databasetest (conn# 0) already closed [exec] INSTRUMENTATION_CODE: 0 [echo] Downloading coverage file into project directory... [exec] remote object '/data/data/com.timsu.astrid/coverage.ec' does not exist

BUILD FAILED

On the logcat, it shows that:

05-30 18:19:20.287: E/AndroidRuntime(8656): FATAL EXCEPTION: Thread-351 05-30 18:19:20.287: E/AndroidRuntime(8656): java.lang.IllegalStateException: database /data/data/com.timsu.astrid/databases/databasetest (conn# 0) already closed 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteDatabase.verifyDbIsOpen(SQLiteDatabase.java:2082) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:413) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:400) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:79) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:160) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:152) 05-30 18:19:20.287: E/AndroidRuntime(8656): at android.database.CursorWrapper.getCount(CursorWrapper.java:53) 05-30 18:19:20.287: E/AndroidRuntime(8656): at com.todoroo.astrid.service.TaskService.countTasks(TaskService.java:371) 05-30 18:19:20.287: E/AndroidRuntime(8656): at com.todoroo.astrid.backup.TasksXmlExporter$2.run(TasksXmlExporter.java:113) 05-30 18:19:20.287: E/AndroidRuntime(8656): at java.lang.Thread.run(Thread.java:856)

Seems like something wrong with sqlite part, but never occured during the execution of JUnit test cases. Any comment is welcomed!

timsu commented 12 years ago

That's kind of weird. Our code coverage is pretty bad, unfortunately, but this is the ant command that we use:

cd astrid
ant all clean 
cd ../tests
ant clean emma debug install coverage