r-cochran / cuke_sniffer

A ruby library used to root out smells in your cukes.
MIT License
44 stars 28 forks source link

Allow hooks in separate files in a hooks directory. #86

Closed alexives closed 4 years ago

alexives commented 8 years ago

I've been working on a project that manages a large number of hooks (probably too many, but that's what happens when you test lots of configurations I guess). To manage this we split it up into several files under a hooks directory. I guess we could rename them to match type_hooks.rb and that would work, but I think a directory tree works out cleaner.

The major issue I see here is if you had a file that was like "captain_hooks_env.rb" that had hooks in it, I guess that would be confusing. But at the end of the day, I guess it's your repos so if you want to merge this feel free. I figured I'd offer some of these things separately in case you had other ideas/plans about how to address this sort of thing.

r-cochran commented 8 years ago

I'll have to think some about this one. I've been in that configuration hell with hooks before, but my team for the most part was able to manage with a single file. From a tool perspective I don't believe Cucumber cares at all where the hook is even defined as long as it is in a rb file that gets interpreted before the Cucumber tests begin. So we could have hook definitions hiding in our step definition files. I've not tested this yet.

I'll get back to you on this. If nothing else we have an example here for others to reference if they want to tweak their own version or dynamically overwrite it at run time.

alexives commented 4 years ago

TBH, right after this I convinced people on my team to stop using cucumber entirely and move all post deploy testing to rspec. So anyway, I'm going to go ahead and close this PR since it's now almost 4 years old.