We are new to using cucumber with selenium to write automated test suites.
Our initial approach was to have one java class per feature file.
Now we added instance methods in each class for corresponding step definitions.
Now if we need to re-use a step definition in some other feature file we are facing problems as we can't re-use same annotation with same regex pattern with any other method of other class and neither can we use the existing step definition which is in some other class.
These methods are sharing instance variables like the reference to the driver.
Now to re-use an instance method as a step definition is also a problem because these methods are not re-usable outside the class and I can't put all step definitions inside one class.
I looked at some samples of ruby, I found that they write some sort of blocks that don't have access to shared state. They just execute steps.
So in Java should I always make static methods that will just execute steps one by one and share no state ?