Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to navigate from feature file to step definition in VSCode

I am primarily using RubyMine for Cucumber/Ruby, and now, I'm getting my hands on VSCode, with which I'm able to run and debug test cases.

I can't find a way to navigate from feature to step definition. I tried searching for extensions and cucumber-step-mapper doesn't help.

Is there any config which enables navigation from feature to step definition?

like image 311
Vignesh Paramasivam Avatar asked Jul 19 '17 15:07

Vignesh Paramasivam


2 Answers

You can install Cucumber (Gherkin) Full Support extension from the VSCode Marketplace:

After install is finished, reload VSCode. Now in order to make it work for Ruby, you need to:

  • Press Ctrl + , to open User Settings

  • Scroll down to Cucumber Auto Complete

  • On the right side you need to modify these settings (you can find 2 examples of how to do this on the extension page). In my case, I added the following:

      "cucumberautocomplete.steps": [
          "features/step_definitions/*.rb"
      ],
      "cucumberautocomplete.syncfeatures": "features/*feature"
    
  • Reload VSCode

  • Open a .feature file and right click any step, you should have Go To Definition and Peek Definition working.

Hope you get it working!

like image 53
Daniel Fintinariu Avatar answered Nov 03 '22 01:11

Daniel Fintinariu


I have a cucumber with java project and following worked for me:

 "cucumberautocomplete.steps": [
    "**/*Steps.java"
],
"cucumberautocomplete.syncfeatures": "**/*.feature"
like image 45
Jyoti Prakash Avatar answered Nov 02 '22 23:11

Jyoti Prakash