MyBatis Mappers code coverage

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MyBatis Mappers code coverage

Bertrand CHEVRIER
Hi,

We are migrating ours applications to MyBatis. Something important for us (and more important for the boss) are the quality metrics. The applications that use mybatis have now a lower code coverage indicator because most of the integration tests are made on the mapper layer. Since the mappers are XML files they are not instrumented by Cobertura anymore.
I saw that each mapper is instantiated through a proxy : org.apache.ibatis.binding.MapperProxy.

Is there a way to instrument the mappers classes generated by MyBatis?

Thanks

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis Mappers code coverage

Larry Meadors
That shouldn't make your coverage go down - it's adding no untested code.

In my reports, they show up as 100% tested (0/0) for all the measurements.

Larry


On Tue, Feb 26, 2013 at 6:58 AM, Bertrand CHEVRIER
<[hidden email]> wrote:

> Hi,
>
> We are migrating ours applications to MyBatis. Something important for us
> (and more important for the boss) are the quality metrics. The applications
> that use mybatis have now a lower code coverage indicator because most of
> the integration tests are made on the mapper layer. Since the mappers are
> XML files they are not instrumented by Cobertura anymore.
> I saw that each mapper is instantiated through a proxy :
> org.apache.ibatis.binding.MapperProxy.
>
> Is there a way to instrument the mappers classes generated by MyBatis?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: MyBatis Mappers code coverage

Bertrand CHEVRIER
As well, I should have precise that we use a custom indicator based on the number of integration test and the code coverage percentage.

On Tuesday, February 26, 2013 3:02:56 PM UTC+1, Larry Meadors wrote:
That shouldn't make your coverage go down - it's adding no untested code.

In my reports, they show up as 100% tested (0/0) for all the measurements.

Larry


On Tue, Feb 26, 2013 at 6:58 AM, Bertrand CHEVRIER
<<a href="javascript:" target="_blank" gdf-obfuscated-mailto="s8BpkeQUM50J">chevrier...@...> wrote:

> Hi,
>
> We are migrating ours applications to MyBatis. Something important for us
> (and more important for the boss) are the quality metrics. The applications
> that use mybatis have now a lower code coverage indicator because most of
> the integration tests are made on the mapper layer. Since the mappers are
> XML files they are not instrumented by Cobertura anymore.
> I saw that each mapper is instantiated through a proxy :
> org.apache.ibatis.binding.MapperProxy.
>
> Is there a way to instrument the mappers classes generated by MyBatis?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="s8BpkeQUM50J">mybatis-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis Mappers code coverage

Dridi Boukelmoune
Hi,

You should instrument the SqlSession class instead since runtime
proxies to your interfaces end up calling methods there. You can
easily get IDs and match them with your xml files with a bit of xpath
or whatever. If you want branch coverage, you'll need to instrument
the class that generates the dynamic SQL.

Good luck,
Dridi

On Tue, Feb 26, 2013 at 3:10 PM, Bertrand CHEVRIER
<[hidden email]> wrote:

> As well, I should have precise that we use a custom indicator based on the
> number of integration test and the code coverage percentage.
>
> On Tuesday, February 26, 2013 3:02:56 PM UTC+1, Larry Meadors wrote:
>>
>> That shouldn't make your coverage go down - it's adding no untested code.
>>
>> In my reports, they show up as 100% tested (0/0) for all the measurements.
>>
>> Larry
>>
>>
>> On Tue, Feb 26, 2013 at 6:58 AM, Bertrand CHEVRIER
>> <[hidden email]> wrote:
>> > Hi,
>> >
>> > We are migrating ours applications to MyBatis. Something important for
>> > us
>> > (and more important for the boss) are the quality metrics. The
>> > applications
>> > that use mybatis have now a lower code coverage indicator because most
>> > of
>> > the integration tests are made on the mapper layer. Since the mappers
>> > are
>> > XML files they are not instrumented by Cobertura anymore.
>> > I saw that each mapper is instantiated through a proxy :
>> > org.apache.ibatis.binding.MapperProxy.
>> >
>> > Is there a way to instrument the mappers classes generated by MyBatis?
>> >
>> > Thanks
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mybatis-user" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to [hidden email].
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "mybatis-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.