0

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.

Denamix
  • 51
  • 5
  • Hi there! Welcome to Stack Overflow. Questions asking for recommendations for libraries, utilities etc. are off-topic, however the first couple of results for https://www.google.com/search?q=ruby+find+unused+code are all worth looking into. – mikej Apr 03 '18 at 20:34
  • Have you googled "ruby code coverage"? What have you tried? There are a plethora of tools available for precisely this. – Tom Lord Apr 03 '18 at 20:37
  • I've tried so far: joshuaclayton/unused -which fails to install either by brew or stack; gem zombie_scout - which errors out as well; debride - works but only shows unused methods and not stats for the usage. – Denamix Apr 04 '18 at 21:50

2 Answers2

0

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

Extrapolator
  • 774
  • 1
  • 8
  • 13
0

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.