Availability of coverage reports for the blind

Currently, I am helping a member of my team cope with our new project and the tools we use. We use Java as the main language. The peculiarity of my colleague is that he is blind. It works mainly with Emacs, and it runs maven targets in the terminal.

After I have completed the implementation, it is very useful for me to check my test coverage. I would like my colleague to also be able to check coverage. I have two ways to get this information:

  • Use the IntelliJ integrated test coverage (it uses EMMA and shows green, red, or yellow next to each line). It’s very convenient, because I immediately see this information after running the tests without further interaction

    This will not work for my colleague, since he cannot use IntelliJ, and probably it will not work, since the textual representation of coverage information will not

  • Use Cobertura reports. They use the same line concept in green / red. They are great for macro information, such as general coverage in a class, but not for checking which row was not covered. In fact, he could delve into the HTML sources of the report and figure out which one has the nbHitsUncovered class, but it seems very impractical.

I would really like to show him how to quickly get data on his coverage. Does anyone know a tool that shows coverage without relying on colors? Or do we need to write ourselves? (e.g. by converting an HTML report)

+4
source share
3 answers

Im a completely blind developer who does my work on Windows using the Jaws check reader for Windows, so this will not exactly match the developer you work with. With a little programming, it seems that the cobertura test results are easiest to process. Based on the following XML report example, it shouldn't be difficult to combine a fast Perl script to check for lines with a hit count of 0. https://raw.github.com/jenkinsci/cobertura-plugin/master/src/test/resources/hudson/ plugins / cobertura / coverage-with-data.xml I was able to find out that line 24 was the only one that ran 0 times with a quick find for

 Hits="0" 

Although I managed to figure out which line was not executed, I had to scroll a bit to find out which class and method were on that line. A fast Perl script can eliminate the need for scrolling and providing a package, class and line method is more efficient. I took a look at a sample Emma HTML report using Google Chrome, and it was pretty affordable. I could say which methods were fully tested and which were not. Figuring out which lines were executed and which were harder. I could say that the method was not 100% complete, and then switched to it in the report. Then I had to use the key press that I read on the screen to declare a color on each line of code. I forget the exact color names, but I can tell the lines that were and were idle, since my screen readers displayed them as different colors. This worked, but was slow since I had to manually check each line of the method; this has not been fully completed since my screen reader cannot automatically declare color changes. I am not sure how your developer will fulfill the equivalent, since I do not know how to fine tune the assistive technologies.

+5
source

I have a dig around Antoine, as I also use SONAR and Cobertura in my projects and am intrigued by your problem. From what I see, when you tell the ANT task to generate "html" as output, you get all the information you need about the strings, but, as you pointed out, this is not an easily parsed format (and maybe can be changed).

With SONAR, I tell Cobertura to output "xml", which gives me a file called coverage.xml with the output. Unfortunately, it does not include linear data, and I do not see any ANT parameters to include them from Cobertura docs.

It seems to me that a file named cobertura.ser contains all the required data, but only an HTML report is displayed for it. I believe the answer to your question may be to try to extract the required serialized data from cobertura.ser.

Looking at the source code, I see the following classes

 net.sourceforge.cobertura.reporting.html.HTMLReport net.sourceforge.cobertura.reporting.xml.XMLReport 

What I suspect you can try and do is take a copy of HTMLReport as a base and try to write the same output as XML, which you can then parse for your own purposes (or mjust ad - the same method calls that are used HTMLReport in XMLReport). I can see the nbHitsUncovered string in HTMLReport , so hopefully you only have one class to write to.

I googled around and don't see anyone do this, but it looks like a useful improvement.

+2
source

How to use a GreaseMonkey script that searches for all rows that have the nbHitsUncovered class and adds some list / table containing the information that is required for the report?

0
source

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


All Articles