I’ve opened a PR suggestion with simplecov - PR suggestion- show which spec executed a code. · Issue #1031 · simplecov-ruby/simplecov · GitHub but decided to post the question also here if anyone has found a solution
simple cov shows the number of time a code was executed, but not which spec was responsible for executing this code. I could not find this as a feature and I thought it will be interesting for us to implement it.
You click on the “Number of times the line was executed” and you see a table of the specs that were running when the line was touched, possibly even the stack trace.
What this will allow us is to quickly see which specs are testing a certain method.
In our new project there are a lot of specs both system and model and some of the code is tested through system specs but because system specs test a lot of things and test a feature on a high level it is difficult to quickly understand which system spec tested what.
This also allows us to identify cases where we are overtesting. Probably a few system specs are doing similar things and we can easily get rid of them and reduce the number of specs we have to support and also the execution time of the specs.
Have you tried to achieve this?