Java: Which code coverage tool to use?

Here is what I want to do:

1) The application has earned. The bytecode is clear - meaning that trace information must be added at the bytecode level.

2) The launch of the application may take several days or weeks. I want to have a trace file once a day.

3) If the trace period is over, I want to combine all the trace files and create one HTML report for developers.

Here is what I have explored so far:

  • Emma seems to be doing a good job when it comes to question 1) The on-the-fly toolkit is very simple.

  • Cobertura says they are capable of performing byte hardware, but I have not found an example.

  • Neither Cobertur nor Emma talk about the periodic burial of archive files.

  • I'm not sure about clover. Maybe someone already looked at him.

Has anyone done this before and can help me with these problems?

Thanks Detlef

+4
source share
4 answers

Cobertura does a great job with your code. It will upload .ser files that can be combined together.

The only part I haven't tried is taking a picture every day. My two ideas are to try either

a) What happens if you copy the .ser file and delete the old .ser file. Will it crash, or will it create a new .ser file? If he creates a new file, this will work.

b) Is it possible to disconnect the application for 1 minute per day to copy and delete the .ser file?

In any case, when you have a bunch of .ser files, it’s very easy to merge them toegether and create an html report.

+2
source

Clover is nice too.

+1
source

Our SD Java Test Coverage Tool allows you to delete a snapshot of the test coverage at runtime at any time convenient for you, by calling a special method,

If you have been running the application for a long time and want a daily snapshot, you can add an additional stream that waited 24 hours, reset the snapshot, and return to sleep. Each snapshot gets its own date file. You can combine as many of them together as you want and create an XML coverage report (and then an HTML report in the format you need).

0
source

Disclaimer: I'm a Clover developer at Atlassian.

Regarding your requirements and features of Clover:

The launch of the application can take several days or weeks.

If you want to collect only global coverage data, then this should be good.

If you also want to collect coverage for each test, then I assume that running the tests in a few weeks will lead to a lot of data, and this can greatly affect performance. But I believe that you are not talking here.

I want to have a trace file once a day

Clover allows you to set a data dump at specified intervals (for example, "flushpolicy =" <clover-setup flushpolicy = "interval" flushinterval = "86400000">). See clover-setup for more details.

It is worth noting that Clover does not reset the counters after deleting the coverage data to disk. Therefore, in fact, there is no need to write one trace file per day (you can do this if you want, of course), this is enough when Clover will write all the data at the end.

I want to merge all trace files together and create one HTML report for developers

Clover has no problem. In fact, this is the default behavior to find all coverage record files associated with a given database during report generation.

It is also possible to create several reports with links between them if you need to.

0
source

Source: https://habr.com/ru/post/1316676/


All Articles