dev@jersey.java.net

Re: More extensive unit testing and code coverage report?

From: Yegor Bugayenko <egor_at_technoparkcorp.com>
Date: Thu, 17 Feb 2011 14:20:58 +0100

I created a simple ticket JERSEY-651, where some initial changes are
introduced. Would be nice to get some comments/corrections before I
continue. I decided to start with jersey-server module, since it's one of
the most important ones and the situation there is rather sad: 307 source
files and 3 unit tests. I'd be glad to improve it.


Yegor Bugayenko



On Thu, Feb 17, 2011 at 1:24 PM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:

> Hello,
>
> please see inline.
>
>
> On 02/17/2011 12:29 PM, Yegor Bugayenko wrote:
>
> Hi Pavel,
>
> Maybe you can use maven-cobertura-plugin (
> http://mojo.codehaus.org/cobertura-maven-plugin/)? Using this plugin you
> won't need any script. You just add a few lines to the parent pom.xml, and
> that's it. Or you're already proceeding this way?
>
> yep, it is done that way, you may check poms if you want. It wasn't that
> simple with jersey, but I managed to get usable results from what we have
> now; the script I posted previously is used mainly for coverage info
> collection and report generation. If you have some experience and/or want to
> suggest some improvement, feel free to do so.
>
>
>
> I'd be glad to contribute with unit tests. Shall I submit them as patches
> in JIRA or I can get a write-access to SVN? Any approach is fine for me.
>
>
> JIRA issues with patches is good way how to start, you might get write
> access to svn after few added tests (we just need to have chance to review
> your work, check whether tests don't break anything.. simply - gain mutual
> trust).
>
> Regards,
> Pavel
>
>
>
>
> —
> Yegor Bugayenko, PMP®
> www.tpc2.com <http://www.TechnoParkCorp.com> (Team as a Service™)
> tel. 650.681.4161, skype: egor256
>
>
>
> On Thu, Feb 17, 2011 at 12:22 PM, Pavel Bucek <pavel.bucek_at_oracle.com>wrote:
>
>> Hi Egor,
>>
>> well, there is definitely room for improvement, I recently modified jersey
>> poms to include cobertura do to code coverage and we can see that not
>> everything is covered as we would like.
>>
>> But! For example, jersey-core does not have much unit tests in itself
>> included, but you can find jersey-core related tests in jersey-tests module.
>>
>> If you want to see test coverage for jersey, you can test it by yourself
>> or wait for a week or so, I plan to publish them on project page or
>> somewhere visible.
>>
>> "script" you can use to generate test coverage report with cobertura
>> (don't execute it unless you know what you are doing):
>>
>>
>>
>> svn co svn cp https://svn.java.net/svn/jersey~svn/trunk/jersey
>> cd jersey
>>
>> rm -rf ./osgi # we don't care about this, its just duplicate of
>> jersey-tests
>>
>> mvn clean install -Dmaven.test.skip=true -Dcobertura
>> find . -d -name src | sed 's/src/pom.xml/' | while read X ; do mvn clean
>> cobertura:cobertura -Dcobertura -DforkMode=never
>> -Dnet.sourceforge.cobertura.datafile=./cobertura.ser -f "$X" ; done
>>
>> rm ../cobertura*
>> rm ./cobertura_final.ser
>>
>> mkdir ../sources
>> find . | grep src/main/java$ | while read X ; do cp -r "$X"/* ../sources/
>> ; done
>>
>> I=1; find . | grep cobertura.ser$ | while read X ; do cp "$X"
>> ../cobertura$I.ser ; I=$(($I+1)) ; done;
>> cobertura-merge.sh --datafile ./cobertura_final.ser ../cobertura*
>>
>> rm -rf ../report
>>
>> cobertura-report.sh --datafile ./cobertura_final.ser --destination
>> ../report --format html ../sources/
>>
>>
>> Best think you should do now is:
>> - create new tests which will improve test coverage
>> - create new issue on issue tracker, add your diff as a patch to it
>>
>> Others might add something; nevertheless, we are looking forward to
>> hearing for you again and it would be really goof if you'll be able to
>> contribute!
>>
>> Thanks in advance,
>> Pavel
>>
>>
>> On 02/17/2011 11:52 AM, egor_at_technoparkcorp.com wrote:
>>
>>> I'm a using Jersey for the last year in a few projects of my company.
>>> The framework is great, but according to what we see in its source code
>>> repository there is a lack of unit tests for key modules, like
>>> jersey-api, jersey-core, etc.
>>>
>>> I'm willing to contribute to the project and create missing unit tests,
>>> which will increase entire project coverage. I already filled my SCA.
>>> Please help me to do this. Thanks!
>>>
>>>
>>>
>>
>>
>
>