Configure template for StepDefintions and Actionwords separately


#1

Hello,
I am currently working with cucumber-java, and I’ve been trying to modify the handlebar actionwords.hbs to produce a customized StepDefinitions file, but it appears that modifying the actionwords.hbs and overriding the templates makes the resulting Actionwords.java to be an exact copy of StepsDefinitions.java.

So my concern here is, how to do I propery override the templates of both files separately from one another?


#2

Hi Federico,

It is possible to handle this use case by using a folder structure in your templates folder. You can have a look at this Github project for example using this: https://github.com/hiptest/hps-cucumber-javascript/tree/cucumber-js-3/templates

In your case, you would have something like:

-templates
  - java
    - actionword.hbs   # Override "real" action words
  - cucumber
    - java
      - actionword.hbs # Override step definitions generation

Best regards,
Vincent