cucumber / cucumber/cucumber-eclipse

Fix unmatched steps and implement snippet support

Open
#572 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
behave-backend
Dominant language
Java
Stars
204
Forks
151
Avg merge
20h 46m
Merged PRs (30d)
8

Description

Currently it seems unmatched steps are not showing an error marker when using behave/python backend. Apart from that we want snippet support but this only works if unmatched steps are correctly detected and shown as a marker.

If there are unmatched steps the output looks like this

```
You can implement step definitions for undefined steps with these snippets:

@when(u'I add 2 and 3 numbers')
def step_impl(context):
raise NotImplementedError(u'STEP: When I add 2 and 3 numbers')

@given(u'I have a calculatorx')
def step_impl(context):
raise NotImplementedError(u'STEP: Given I have a calculatorx')

@given(u'I have a calculatorrrr')
def step_impl(context):
raise NotImplementedError(u'STEP: Given I have a calculatorrrr')

@given('I have a calculator') # python-calculator/features/steps/calculator_steps.py:19
Given I have a calculator # python-calculator/features/calculator.feature:7

@when('I subtract {a:d} from {b:d}') # python-calculator/features/steps/calculator_steps.py:27
When I subtract 3 from 5 # python-calculator/features/calculator.feature:13

@when('I multiply {a:d} by {b:d}') # python-calculator/features/steps/calculator_steps.py:31
When I multiply 2 by 3 # python-calculator/features/calculator.feature:18

@then('the result should be {expected:d}') # python-calculator/features/steps/calculator_steps.py:35
Then the result should be 5 # python-calculator/features/calculator.feature:9
Then the result should be 2 # python-calculator/features/calculator.feature:14
Then the result should be 6 # python-calculator/features/calculator.feature:19

UNUSED STEP DEFINITIONS[1]:
@when('I add {a:d} and {b:d}') # python-calculator/features/steps/calculator_steps.py:23

UNDEFINED STEPS[3]:
When I add 2 and 3 numbers # python-calculator/features/calculator.feature:8
Given I have a calculatorx # python-calculator/features/calculator.feature:12
Given I have a calculatorrrr # python-calculator/features/calculator.feature:17
```

From the output we see `UNDEFINED STEPS` gives us a lit of where we need to do something, and we can match the text against the proposed snippets.

We then can use this to build a map we later pass to the markerfactory to get a quickfix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.