MichalH.
MichalH.

Reputation: 29

CUCMBER feature definition in different module than feature file

first of all - I am not sure if cucumber support this, but is it possible to define features in different module than in one that contains feature files?

Given real life example: Let's say I want to have module called 'carcore', Then let's say I want to have module called 'Volkswagen', and other one called 'Ford'.

Is it possible that I will put feature deffinition files for common features in 'carcore' module but keep feature diffinition files specific for vokswagen or ford in their own modules?

I am using gradle to sew this modules together. It is more or less simple. Though when Cucumber annotations are introduced, it is not that easy. Cucumber is not able to find feature definitions in other modules. I was not able to find any relevant and useful reading, so if anyone can help me or point me into right direction I would be very glad.

Upvotes: 0

Views: 869

Answers (2)

MichalH.
MichalH.

Reputation: 29

It is done automatically as with any other classes. Cucumber will pick up automatically any feature definition files that are in defined dependencies.

My IDE didn't picked up the relation between feature definition file and feature itself, so it got me confused.

Upvotes: 0

diabolist
diabolist

Reputation: 4099

Cucumber is designed so that you have one World for your features, and in that world each thing you talk about should have a unique name and a single definition. It deliberately chooses to not have any kind of name-spacing. The rationale behind this is that Cucumber is a tool for describing business behaviour not for programming.

What you are doing with your modules is programming, and what you seem to reflecting is HOW your program is implemented, but HOW has no place in Cucumber scenarios; they should be written way before you think about HOW to do things. Scenarios should only be about WHAT the business wants and WHY they want this.

What you can do with your modules idea is push it down your stack, into the step definitions or better yet modules that define calls that your step definitions can use. Now because you are in a programming language you have the power to program in whatever way you need.

Finally Ford and Volkswagen are brands of Car. Whilst you might use the names as examples having a module for an individual brand seems wrong at any level.

Upvotes: 1

Related Questions