collect stats on method usage in non-rails ruby project

117 Views Asked by At

I have a project where we keep our acceptance test code. It has about 1100 methods that I use for dealing with various aspects of the UI the project is quite old so I suspect that some methods are stale and never get used. Tests are run as Rspec tests. I would like to somehow create statistics method usage to delete stale ones and create a list of top 20 or 30 which are in active use. Any ideas how I can collect that data?

To give more detail: I have all of the supporting page-object methods in lib directory. I run about 100 spec tests which call methods from these page objects. I want to collect stats on how often these methods from lib/ directory get used.

2

There are 2 best solutions below

0
On

You can try https://github.com/danmayer/coverband it's a dynamic analysis tool, it should get you the data you need

0
On

You can try using a deforest

It's an easy to use gem that tracks the number of times your model method are called and presents this data segmented as most used, medium used and least used. Exactly what you are looking for.