Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
This is a problem in plugin version 1.1.8 and 1.1.7. Not sure about others.
Steps To Recreate
1. Create a grails plugin
2. install coverage plugin into pkugin project
3. Create a class (call it ClassUnderTest)
4. Import ClassUnderTest into the XXXPlugin.groovy file. I don't think it matters to the problem whether it is actually used
5. Create a test class to unit test ClassUnderTest, and write a test to test at least one of the methods in ClassUnderTest
6. Do "grails clean" followed by "grails test-app --coverage"
The tests pass, but the code coverage report indicates that ClassUnderTest has not been covered by any tests.
If instead you do the do:
grails clean
grails compile
grails test-app --coverage
Then the cobertura report indicates that ClassUnderTest has been tested.
I.e. it matters whether you have pre-compiled ClassUnderTest before running test-app --coverage
Issue Links
| This issue is duplicated by: | ||||
| GPCODECOVERAGE-9 | Plugin reports 0% coverage in plugin |
|
|
|
Thanks for the detailed steps to reproduce. I have narrowed this down to the following code in the _GrailsCompile.groovy script that compiles the plugin descriptor.
Not sure if this is a Grails / Groovy / Cobertura issue but I haven't found a way to automatically resolve this through something in the plugin. In the meantime, the workaround specified in the original description does work:
grails clean
grails compile
grails test-app --coverage