Feature Suggestions

Add keyboard shortcut for Show coverage for selected test only

Started by yanglee on 7,349 views

I use "Show coverage for selected test only" a lot. It greatly helped me understand my code and quickly locate the source of an issue.

But currently it's located deeply in the sub menu of the right-click menu, took me 2~3 clicks and miles of mouse moves to invoke it. If there was a keyboard shortcut (for example, Ctrl + M, C) to invoke/toggle this feature, my fingers would greatly appreciate it!

Thanks!
Yang
Thanks Yang - I also find myself thinking the same thing.

The problem is how to narrow down the coverage to a single test with the shortest number of keypresses. It could always be possible to adjust this feature so it works for multiple tests at the same time, but I think that this would make the feature confusing and probably wouldn't help much in the 99% of cases where you only want to see what a specific test is touching.

I'm thinking perhaps a single key option inside the coverage popup, i.e. 'S'. So if you were sitting on a line of code and pressed Ctrl+M, S, then positioned the cursor over the test you wanted to narrow down, and just pressed 'S', this would do the trick.

What do you think?
I personally almost always invoke the "Show coverage for selected test only" in the body of the test method (where I start my work). So didn't think about invoking it in the production code, which could have multiple tests to select. But that would be cool :)

The problem is how to narrow down the coverage to a single test with the shortest number of keypresses. It could always be possible to adjust this feature so it works for multiple tests at the same time, but I think that this would make the feature confusing and probably wouldn't help much in the 99% of cases where you only want to see what a specific test is touching.

Agree.

I'm thinking perhaps a single key option inside the coverage popup, i.e. 'S'. So if you were sitting on a line of code and pressed Ctrl+M, S, then positioned the cursor over the test you wanted to narrow down, and just pressed 'S', this would do the trick.

That would be nice. But I still think it would be helpful if it there was another keyboard shortcut, that when I place cursor in the body of a test method, and press Ctrl + M, C (or something else) code coverage would be narrow down to that test. So I wouldn't have to see the coverage popup. If "Show coverage for current test" keyboard shortcut is customizable in Visual Studio's Options dialog, I may even change it to something like F1 or Alt+F1, so that I can invoke it by one hand :)

Edited

Post a reply

Log in to reply.