Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Stable" format for coverage #151

Closed
tmysik opened this issue Jun 20, 2014 · 22 comments
Closed

"Stable" format for coverage #151

tmysik opened this issue Jun 20, 2014 · 22 comments

Comments

@tmysik
Copy link

tmysik commented Jun 20, 2014

Currently, code coverage generates an HTML page which is good for humans. But for other tools (like NetBeans in my case ;), it would be much better to have e.g. XML file, preferably in Clover format (this format is widely used and contains information that perfectly suits our needs).

Thanks.

@dg
Copy link
Member

dg commented Jun 20, 2014

The only documentation I found for clover format https://gist.github.com/aik099/8556655

@tmysik
Copy link
Author

tmysik commented Jun 20, 2014

I have never found any XSD/DTD for it - shame on me (or Atlassian? ;), I know but it was the only usable format for coverage (at least for us) for PHP (PHPUnit) and JavaScript (karma-coverage, or better Istanbul). It has more relevant information than e.g. Cobertura.

Sample for PHPUnit can be found here [1], generator for Istanbul here [2]. I hope it can help.

Thanks.
[1] http://hg.netbeans.org/web-main/file/f749e209fe25/php.phpunit/test/unit/data/phpunit-coverage.xml
[2] https://github.com/gotwarlost/istanbul/blob/f2c84f99739006ec657be45f45ac35f8ad377e13/lib/report/clover.js

@tmysik
Copy link
Author

tmysik commented Jun 20, 2014

One note - the PHPUnit report would be perfectly fine for us.

Thanks.

@tmysik
Copy link
Author

tmysik commented Jun 23, 2014

BTW if you are able to implement it quite soon, I could add support for it for the next NetBeans version (its feature freeze is around July 5th I think).

Thanks.

@milo
Copy link
Member

milo commented Jun 24, 2014

To be sure, you are talking about Clover format developed by the Atlasian company for Java.

I found topic about Clover XSD schema and I found download of Clover-for-Ant which contains mentioned XSD.

I didn't study the schema in detail, but at first glance it requires more information than Tester is possible easily provide now.

Next question about this format is licensing and format stability. The schema I found has not own namespace nor versioning.

@tmysik Don't you know about an another (open) standard? :)

@tmysik
Copy link
Author

tmysik commented Jun 24, 2014

@milo As I wrote, this format suits best to our needs; for each file, we need:

  • file path
  • line count
  • number of statements
  • number of covered statements
  • hit count for covered lines

See [1] for more information.

So, to your questions:

To be sure, you are talking about Clover format developed by the Atlasian company for Java.

Yes.

I didn't study the schema in detail, but at first glance it requires more information than Tester is possible easily provide now.

Yes, it is complex. That is why I wrote that the same "minimal" report as PHPUnit generates now (see my prevous comment for an example) is perfectly fine for us. I know that PHPUnit uses Xdebug extension for it.

Next question about this format is licensing

Not a question for me, sorry, I have no idea. But I would suppose that it is fine to generate this format (since PHPUnit and also other tools do it).

and format stability. The schema I found has not own namespace nor versioning.

Again, I am not able to answer this, sorry.

Don't you know about an another (open) standard? :)

As I wrote, e.g. Istanbul supports these formats [2]:

  • HTML
  • LCOV
  • Cobertura
  • TeamCity
  • Clover

For us, only HTML and Clover are usable (contain information we need). HTML is bad because it is very easy to change it so any parser can be easily broken.

Just to be sure - we do not need Clover, we need any (likely XML) format which provides information I have described above. We are totally OK with your own format if you are going to create any.

Thanks guys.
[1] http://hg.netbeans.org/web-main/file/tip/web.clientproject.api/src/org/netbeans/modules/web/clientproject/api/jstesting/Coverage.java
[2] https://github.com/gotwarlost/istanbul

@TomasVotruba
Copy link

clover format is also only one accepted by scrutinizer (command detail), since it's default output of phpunit.

So at the moment there's no way to get that nice "test coverage badge".

Currently supported formats are only html and serialized string, aren't they?

@milo
Copy link
Member

milo commented Dec 8, 2014

I was discussing that on PoSobota and the Clover format is really one of the most spreaded out. This is WIP now.

@TomasVotruba
Copy link

@TomasVotruba
Copy link

Just FYI, I've decided to use PHPUnit due to simple clover generation, so this issue is solved for me.

@matej21
Copy link

matej21 commented Dec 13, 2014

I've tried this as a replacement of html template and it works great with the phpstorm...

@TomasVotruba
Copy link

@matej21 Do you have some repo where you use it with scrutinizer?

Why not PR?

@milo
Copy link
Member

milo commented Dec 15, 2014

I sank into the issue. The problem is, I didn't find any official Clover schema/specification. The only available XSD I found is from Clover for Ant project (it is the same as in the David's first comment). The question is, how much the XSD describes real requirements, because we are not able to achive them all (not nearly). Because an XML coverage report must:

  • use some name (easy)
  • describe project sources and tests sources separately (not so hard)
  • expose metrics like count of conditionals, elements, statements, methods and their covered equivalents
  • these metrics are mandatory for every project (only one in our case), package (let's say namespace), file and class

These all are required by mentioned XSD, I didn't write about optionals. PHPUnit exports some of these but it is not XSD compatible too.

So, implementation is about compromise for now. And the easiest is the @matej21's one.

So, @tmysik, @TomasVotruba, @Vrtak-CZ... do you have some relevant links for me, where is a some Clover compatibility description? For tools Netbeans, PhpStorm, Sruntinizer, Jenkins CI.

@JanTvrdik
Copy link
Contributor

I would suggest using the simple approach as suggested by @matej21, release it as experimental feature and see how it will work in real world.

@TomasVotruba
Copy link

Either @JanTvrdik 👍 or mimic PHPUnit output I linked.

@Vrtak-CZ
Copy link
Contributor

Sorry I didn't have any info about schema / specification. But I agree with @JanTvrdik

@tmysik
Copy link
Author

tmysik commented Dec 16, 2014

@milo I already answered what would be the best from the NetBeans' point of view, see my comment from July 24th (#151 (comment)).

@milo
Copy link
Member

milo commented Jan 12, 2015

@matej21 How does it work with phpStorm for you? I mean, how do you load the generated XML by phpStorm?

@matej21
Copy link

matej21 commented Jan 12, 2015

@milo Tools/Show code coverage data

@milo
Copy link
Member

milo commented Jan 12, 2015

Indeed! Thanks.

@milo
Copy link
Member

milo commented Jan 12, 2015

WIP PR #196

@jkuchar
Copy link
Contributor

jkuchar commented Sep 17, 2015

This looks like ready for closing :)

@milo milo closed this as completed Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants