Using multiple Step Definitions Files
So I've been using SpecFlow for a while and I'm moving to Cucumber in my new job. I'm aware they are both similar so I wanted to ask about using multiple step definitions files.
I'm my previous project, the automated testing went across two or tree different applications and I made the mistake of having all the step definitions in one large file which made managing them a bit difficult.
In the new project I would prefer to have separate step definitions files to cover the different applications. What I'm not sure about is that previously I had a lot of sections for [BeforeTest] [Before Scenario] and [After Test] etc so that it would set up the test and clean up after itself. If you have multiple step definitions files that's called by a single feature, how would I handle those. Would I have one main step definitions file that then references the individual step definitions files? Is this even a sensible approach?
Re: Using multiple Step Definitions Files
I am not sure with cucumber-jvm, but I would be surprise that it would not be the same as with cucumber-js and cucumber-ruby: you can have as many step definition files as you want. And as far as I know, you can also have as many hooks (before/after) as you want and organize those in your step definition files as you want too.
If you are using default, you even have nothing in particular to do.
For example, in cucumber-js, you can totally have something like that, execute cucumber, and it will automatically load the step definitions for you:
$ tree features features ├── step_definitions │ ├── steps-2.js │ └── steps.js └── test.feature
And the same with cucumber-ruby:
$ tree features features ├── example.feature ├── step_definitions │ ├── steps-2.rb │ └── steps.rb └── support └── hooks.rb