D.Guy
D.Guy

Reputation: 31

Contents of .feature file isn't recognized in intelliJ

I wrote feature files in a project in IntelliJ according to the cucumber syntax. This files worked in another computer. I added the cucumber-java jar files and also installed the Gherkin and cucumber plugins, but still feature files aren't recognized as they should be. What could be the problem?

Upvotes: 3

Views: 14781

Answers (5)

saTya
saTya

Reputation: 325

Essentially two things are required to get cucumber feature recognized as expected type.

  1. After adding cucumber-java dependency in pom.xml
  2. You have to add Cucumber plugin also from > Settings>Plugin>MarketPlace>Search for cucumber for Java and install it

This will also ask you to install Gherkin as a Dependency

Select Yes>> Restart ide

Now you have to change file type from settings >> to cucumber scenario.

Note: you wont be getting Cucumber scenario as recognized type until done above installation.

Select cucumber scenario and Add + wildcard for it as-*.feature

Upvotes: 0

md salim
md salim

Reputation: 1

First make sure you have cucumber for java installed, if it is installed follow the below stpes,

1) Create a new feature file, like <test.feature> , after file creation a dialog box pops up

2) Select cucumber scenario in form the list and click Ok, there you GO.

Upvotes: 0

Vladi
Vladi

Reputation: 1990

So i use IntelliJ 2018

1) go to Preference enter image description here

2)in open tab search "File Types" and search for text

enter image description here

3) in Text inside "Registred Patterns" delete "*.feature"

4) then search Cucumber Scenario and add "*.feature" enter image description here

Upvotes: 9

SDV
SDV

Reputation: 353

After installing plugin if you till face problem as i did, my feature files are not getting recognized because of groovy

therefore I manually set

File>>Settings>>Editor>>File Types click "cucumber Scenario" and Click + to add .Feature in Recognize Patterns.

Upvotes: 3

Daniel Fintinariu
Daniel Fintinariu

Reputation: 2793

Steps I took to get .feature files recognized. I know that you've probably done this already, but it might help checking the steps again. If all fails, you could try to reinstall the plugins.

  1. Created a new Java project
  2. Created a new file with the .feature extension. Because the plugins were not installed, got the message "Plugins supporting *.feature files found." with the option to install the plugins
  3. I didn't use this option because the suggested plugins were not what I wanted (check below image):

enter image description here

  1. Instead, I've opened Settings > Plugins > Browse Repositories and searched for Cucumber for Java
  2. When trying to install this plugin you will be required to accept the installation of Gherkin as well. Make sure that after accepting, both plugins are selected.
  3. Restart IntelliJ and you should see the feature files recognized:

enter image description here

Hope it helps!

Upvotes: 5

Related Questions