Feature Suggestions

Visualise coverage per test

Started by AndyLowry on 7,402 views

Having the code coverage markers in the code editor is a fantastic tool. One thing I've found myself doing is looking for "holes" in the coverage to determine if there are any missing tests. (Unfortunately I have to work with a lot of legacy code)

Quite often though I'm trying to work out the opposite, wanting to make sure at least 1 test doesn't take a particular path. I've been doing this by looking at the number of covering tests, and making sure that, for example, the number of covering tests in the body of an if is less than the number executing the condition.

It would be nice if this was easier to visualise.

One way I was thinking this could happen (and I suspect there are many other ways) is the we could quickly switch to a mode where the coverage icons have a column for each test, instead of a single comlumn for all tests.

So (with * filling in for the coverage indicator):

* if (IsConditionTrue())
* {
* DoSomeWork();
* }

would become something like this:

**** if (IsConditionTrue())
**** {
* ** DoSomeWork();
**** }

with the second column having a black indicator showing that that line is not covered by that particular test.

This is not a fully formed idea, theres a lot of options, I don't think you'd want this enabled most of the time, so being able to switch it on and off quickly in the editor would be important. Or possibly having it in a tooltip on each indicator. There are also questions about if it would work when there are very large number of tests.


Andy
Hi Andy -

Thanks for the suggestion!

Out of interest, have you tried making use of the 'Show code coverage for this test only' option under the 'Advanced' context menu when you right click on a test? Generally when I'm following a similar use case, this is what I use myself. Does it solve the same problem for you?


Cheers,

Remco

Edited

Hi Remco,

It does allow me to do what I want but I still have to go through all the tests one at a time. I would be easier if I could just scan the coverage indicators.

Thanks

Andy
Thanks for the feedback. Given that lines can be covered by potentially huge numbers of tests (i.e. 1000s), I'm not sure if I can cleanly implement such a feature, but I'll have a think about your use case and will see what I can come up with!

Post a reply

Log in to reply.