cucumber / cucumber-eclipse

Eclipse plugin for Cucumber
MIT License
192 stars 149 forks source link

Javascript Support #283

Open wattle9 opened 5 years ago

wattle9 commented 5 years ago

Hi, I have created a Java Script project to implement Protractor scripts and it works fine. I need to implement Protractor scripts based on Cucumber framework. I have downloaded all required Cucumber plugins.

I have done "test.feature"

features/test.feature

Feature: Running Cucumber with Protractor As a user of Protractor I should be able to use Cucumber In order to run my E2E tests

Scenario: Protractor and Cucumber Test
    Given I go to "https://angularjs.org/"
    When I add "Be Awesome" in the task field
    And I click the add button
    Then I should see my new task in the list

I just need to know how do I generate step definitions using test.feature. Is there any wizard /way to do it?

screen shot 2018-09-26 at 11 10 29 pm
jkuester commented 5 years ago

I think the easiest way to generate the step def snippets would be to just execute your feature with cucumber-js. For all of the missing steps, it should print a snippet to the console.

I have not done it before, but it looks like you can use some arguments to control various details about the generated code: https://github.com/cucumber/cucumber-js/blob/master/docs/custom_snippet_syntaxes.md

wattle9 commented 5 years ago

I have seen how to generate step definitions for Java projects in Eclipse.But, I didn't come across a way to do for Java Script projects.I am not sure whether this facility is in Eclipse.

qvdk commented 5 years ago

I think @wattle9 is talking about the quick fix feature. You can access it after you write new steps in a feature file. Then, the markers panel shows the missing glue codes. screenshot from 2018-10-04 00-50-49

screenshot from 2018-10-04 00-45-22

This one allows to generate step into a StepDefinitions Java class.

The cucumber-eclipse-plugin provides for now only Java (JDT) support. Thus, a such implementation for Javascript does not exist.

Imspaliwal commented 5 years ago

@wattle9 Could you please let me know, how to generate step definitions for Java projects in Eclipse.

Quick fix not work for me in eclipse. Also Console is not generating output for me after running runner class to implement missing steps.

laeubi commented 5 years ago

Then something is strange with your feature file... Because the plugin uses cucumber to generate the missing steps code it won't work if cucumber itself does not detect your missing steps/can generate code for it...