[Python] cucumberautocomplete does not recognize my step definition if I have step arguments

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    I am currently using pytest-bdd 7.2.0

    I have a step definition below in my test.feature.

    Given the user is logged in using "admin" account


    When I hover my mouse over it, it shows a warning of "Was unable to find step for "Given the user is logged in using "admin" account". That means cucumberautocomplete does not recognize this step even though I have correct syntax:

    @given(parsers.parse('the user is logged in using "{account}" account'))
    def login(context, account):
    ...


    What really bothers me is when I do not have step arguments in my step definition. cucumberautocomplete recognizes the step and I can right click -> Go to definition. I will then be redirected to

    @given("some step without step argument")
    def step(context):
    ...


    I have tried playing around with my settings.json to change cucumberautocomplete settings but to no avail.

    {
    "python.testing.pytestArgs": [
    "."
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    "cucumberautocomplete.syncfeatures": "src/test/features/*.feature",
    "cucumberautocomplete.steps": [
    "src/test/*.py"
    ],
    "cucumberautocomplete.strictGherkinCompletion": true,
    "cucumberautocomplete.strictGherkinValidation": true,
    "cucumberautocomplete.skipDocStringsFormat": true,
    "cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then)\\(",
    "cucumberautocomplete.smartSnippets": true,
    "cucumberautocomplete.customParameters": [
    {
    "parameter": "{/\\{.*\\}/}",
    "value": ".*"
    }
    ]
    }


    My code is definitely working when I run it. It just bothers me that if my step definition has step arguments, it shows a yellow warning line beneath the sentence and I cannot immediately go to my step via right click -> Go to definition. I need to manually search for the step via ctrl + shift + f in vscode.

    Does anyone know a solution for this? Or is this a known limitation?

    Continue reading...

Compartilhe esta Página