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

Frank core steps make it more difficult to discover unused project steps #236

Open
rhgills opened this issue Aug 13, 2013 · 2 comments
Open

Comments

@rhgills
Copy link

rhgills commented Aug 13, 2013

When running cucumber with the stepdefs formatter, looking for unused steps, using something like the following:

cucumber -d -f stepdefs --color | grep "NOT MATCHED BY ANY STEPS" -B1

you'll see lots of output corresponding to unused steps bundled with frank, such as:

/^I wait to see a navigation bar titled "([^\"]*)"$/
# Frank-743854779301/gem/lib/frank-cucumber/core_frank_steps.rb:26
  NOT MATCHED BY ANY STEPS
--
/^a pop\-over menu is displayed with the following:$/
# Frank-743854779301/gem/lib/frank-cucumber/core_frank_steps.rb:237
  NOT MATCHED BY ANY STEPS

Is there any way to exclude these in this case, apart from parsing the output? I tried the --exclude cucumber option, which didn't seem to have any effect.

@ondrejhanslik
Copy link
Contributor

I don't think this is possible easily since for cucumber the core steps are undistinguishable from other steps.
However:

  1. --dry-run should simplify the output a bit since the steps will be sorted by filename
  2. filtering by unix command line tools - it should be pretty easy to write a bash/ruby script that will remove the core_frank_steps parts
  3. (my favourite) implement your own formatter. See https://github.com/cucumber/cucumber/blob/master/lib/cucumber/formatter/stepdefs.rb and https://github.com/cucumber/cucumber/blob/master/lib/cucumber/formatter/usage.rb . The changes required to filter out steps defined in a specific file would be minimal.

@rhgills
Copy link
Author

rhgills commented Aug 14, 2013

Yeah, I ended up filtering the output with grep to only those steps found in my project's step definitions directory, in addition to being not matched by any steps. But I never would have thought of writing your own formatter to solve this, that's brilliant! Not sure if that would be something appropriate to bundle with Frank, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants