|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Code coverage reports - finding name of closureI'm trying to add an enhancement to the code-coverage plugin that
would show the name of a closure in the coverage reports. So for instance, right now the reports show: AccountController$_closure1 AccountController$_closure2 AccountController$_closure3 etc... I'd like it to show AccountController.list AccountController.edit AccountController.create etc... Any thoughts on how I could do this? I'm guessing I will have to do some post processing of the reports, but I'm not positive on how to line up AccountController$_closure1 with AccountController.list This might be a topic for the Groovy list, but I thought I'd start here. Any ideas? Mike --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Code coverage reports - finding name of closureYou could iterate over AccountController's fields and check the class of the error with the class of
the closure defined on that field. ~~ Robert. Mike Hugo wrote: > I'm trying to add an enhancement to the code-coverage plugin that would > show the name of a closure in the coverage reports. > > So for instance, right now the reports show: > AccountController$_closure1 > AccountController$_closure2 > AccountController$_closure3 > etc... > > I'd like it to show > AccountController.list > AccountController.edit > AccountController.create > etc... > > Any thoughts on how I could do this? I'm guessing I will have to do > some post processing of the reports, but I'm not positive on how to line > up AccountController$_closure1 with AccountController.list > > This might be a topic for the Groovy list, but I thought I'd start > here. Any ideas? > > Mike > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- ~~ Robert Fischer. Smokejumper Consulting http://smokejumperit.com Enfranchised Mind Blog http://enfranchisedmind.com/blog LinkedIn Profile http://www.linkedin.com/in/robertfischer Twitter Feed http://twitter.com/robertfischer --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Code coverage reports - finding name of closureAt 05:59 AM 11/20/2008, you wrote:
>I'm trying to add an enhancement to the code-coverage plugin that >would show the name of a closure in the coverage reports. this thread may be of interest: http://marc.info/?l=groovy-user&m=122237666817167&w=2 --- vice-chair http://ocjug.org/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Code coverage reports - finding name of closureYou can get the controller class bean (a DefaultGrailsControllerClass) from
the Spring context and find the properties that are Closures, and map their field names to their classes: def controllerClass = ctx.getBean('com.foo.bar.controller.AccountControllerClass') def closures = [:] controllerClass.reference.propertyDescriptors.each { propertyDescriptor -> def closure = controllerClass.getPropertyOrStaticPropertyOrFieldValue(propertyDescriptor.name, Closure) if (closure) { closures.put(propertyDescriptor.name, closure.class.name) } } -- Burt On Thursday 20 November 2008 8:59:01 am Mike Hugo wrote: > I'm trying to add an enhancement to the code-coverage plugin that > would show the name of a closure in the coverage reports. > > So for instance, right now the reports show: > AccountController$_closure1 > AccountController$_closure2 > AccountController$_closure3 > etc... > > I'd like it to show > AccountController.list > AccountController.edit > AccountController.create > etc... > > Any thoughts on how I could do this? I'm guessing I will have to do > some post processing of the reports, but I'm not positive on how to > line up AccountController$_closure1 with AccountController.list > > This might be a topic for the Groovy list, but I thought I'd start > here. Any ideas? > > Mike > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Code coverage reports - finding name of closureThanks for all the ideas! Burt, your logic did just what I was
looking for, thanks! Mike On Nov 20, 2008, at 9:37 AM, Burt Beckwith wrote: > You can get the controller class bean (a > DefaultGrailsControllerClass) from > the Spring context and find the properties that are Closures, and > map their > field names to their classes: > > def controllerClass = > ctx.getBean('com.foo.bar.controller.AccountControllerClass') > > def closures = [:] > > controllerClass.reference.propertyDescriptors.each > { propertyDescriptor -> > def closure = > controllerClass > .getPropertyOrStaticPropertyOrFieldValue(propertyDescriptor.name, > Closure) > if (closure) { > closures.put(propertyDescriptor.name, closure.class.name) > } > } > > -- > Burt > > On Thursday 20 November 2008 8:59:01 am Mike Hugo wrote: >> I'm trying to add an enhancement to the code-coverage plugin that >> would show the name of a closure in the coverage reports. >> >> So for instance, right now the reports show: >> AccountController$_closure1 >> AccountController$_closure2 >> AccountController$_closure3 >> etc... >> >> I'd like it to show >> AccountController.list >> AccountController.edit >> AccountController.create >> etc... >> >> Any thoughts on how I could do this? I'm guessing I will have to do >> some post processing of the reports, but I'm not positive on how to >> line up AccountController$_closure1 with AccountController.list >> >> This might be a topic for the Groovy list, but I thought I'd start >> here. Any ideas? >> >> Mike >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |