Re: code coverage (Clover, Cobertura, that sort of thing)

Adam Hardy <[email protected]> Sun, 22 Jun 2008 14:12:23 +0100
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Wolfgang Fahl on 22/06/08 11:04, wrote:
> Adam Hardy wrote:
>>  Sorry, I was not being obvious.
>>
>>  If Clover or Cobertura tell me how much of my Java code base my JUnit 
> tests
>>  cover, what reporting tool tells me how much of my JSP and MVC code 
> base my
>>  HttpUnit tests cover?
> I don't know of any tool that does this out of the box - but it sounds 
> like a graph problem. First you need to know what the graph is - what 
> are the nodes (e.g. links) reachable from your code. I think this is the 
> harder part of the problem since you might want to limit the "range" of 
> the graph. In dynamic applications it might happen that you have 
> variable parameters and could possibly end up with an endless number of 
> nodes - e.g. when a customer id is part of a link and in princpiple all 
> customer id values lead to pages that are considered different by the 
> algorithm.
> 
> If you have the graph with all nodes to test things get simpler - each 
> HttpUnit test has to mark the node it visited. You can then analyze the 
> "code coverage" by analyzing how much of the graph has been visited.
> 
> So if you are not looking for a general solution but one that works for 
> your application things might get simpler. The task you are describing 
> could be a nice part for the httpunit tutorial showing how test-coverage 
> could be followed. We'd  need an example with a not-too big graph and 
> then could show how it works.

I certainly have never heard of a tool either so what you say confirms to me 
that one doesn't exist  - at least, not OSS.

Searching the net did throw up one proprietary software package that seems to 
offer rudimentary facilities in this direction but I didn't look very deep.

I see an opportunity for a new OS project to implement something like this. Your 
graph problem description hits the nail squarely on the head - for an MVC 
application using struts or Spring, the graph could be read from the View 
configuration XML rather than hand-built perhaps.

The concept would need the kind of input which I can't imagine myself being able 
to justify in my present circumstances, although if it was a community project, 
then it might be possible.

Frustratingly I still have a list of high priority stuff to get out the way 
before I can even work more on the concept. I'll keep tabs on the topic though.



Regards
Adam

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php