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

Knowing what tests executed a line #207

Closed
Sebastriani opened this issue Feb 6, 2019 · 7 comments
Closed

Knowing what tests executed a line #207

Sebastriani opened this issue Feb 6, 2019 · 7 comments

Comments

@Sebastriani
Copy link

Sebastriani commented Feb 6, 2019

I think it would be very useful to be able to know what tests executed a line of code, more than the count of times the line was executed. Would it be possible to add this feature?

It's possible to know that information by placing a breakpoint in the line that we want, then executing the tests and look at the Call Stack Window each time the debbuger hits the breakpoint, but that is far more work than just having the info in the report.

@danielpalme
Copy link
Owner

That's already available depending on the coverage tool you are using.

For OpenCover use the coverbytest option
For altcover use the CallContext option

The coverage report will contain a "Coverage by test methods" section, which you can use to toggle between the methods.

See: Coverage

@Sebastriani
Copy link
Author

Wow, how nice!! I use OpenCover, just tried this and it's great! Sorry I didn't find that before, now I found the info in your blog and I see it's a feature since Nov. 4 2012...

In the other hand, don't you think it would be nice to be able to do the opossite, instead of clicking a test to see its coverage, clicking a line to see what tests execute it. So you if you are interested in a specific line, you don't have to go selecting all the tests one by one to see which ones execute that line.

I don't know if that's feasible to do, but I think it would be a nice feature.

@danielpalme
Copy link
Owner

It should be possible to add this feature.

I will consider adding this in the next release.

@danielpalme
Copy link
Owner

Please have a look at the latest version 4.0.13.
If you hover a source line, the test methods on the right are highlighted with green/yellow/red based on the coverage of the currently hovered line.

@Sebastriani
Copy link
Author

Great! Thanks for taking this feature into account!

I have a comment though, it happens that if you have more test methods in "Coverage by test methods" that what can fit the screen, and you want to see the highlighting for the non visible test methods, since the highlighting is produced by hovering the line, you loose the highlighting when going to scroll the list.

So to keep track of the all the test methods for a line you have to go back and forth between the line and the scroll bar.

IMHO, it would be better to click the line to select it, and leave the tests highlighted as long as the line is selected.

@danielpalme
Copy link
Owner

danielpalme commented Feb 23, 2019

I changed the behavior.
Hovering is still possible, but if you click a line it gets selected and hovering is disabled.
New release: 4.0.13.1

@Sebastriani
Copy link
Author

Now that's excellent!
Thanks again

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

2 participants