robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[ENHANCEMENT] Allow for dynamically set suite variables

Open ElKabieri opened this issue 1 year ago • 1 comments

We discussed this functionality in the #vscode slack on the RobotFramework workspace.

Problem description RobotCode only performs a static analysis, i.e. it does not analyse which keyword may have been called at some point previously and whether a variable may have been set somewhere there. This creates a lot of red lines in our repositories since we set suite variables at different times during test suites, which are then re-used in other tests.

For example we reuse data from an API response here:

POST /api/Afspraken/Put
    ${RESPONSE}    Post On Session    ${SESSIENAAM}    /api/Afspraken/Put    json=&{json}
    Set suite Variable    ${ZORGAFSPRAAKID}    ${response.json()['id']}

GET /api/Afspraken/Get/{dossierId}
    ${response}    GET On Session    ${SESSIENAAM}    /api/Afspraken/Get/${dossierId}
    Should Be Equal As Strings    ${response.json()[0]['id']}    ${ZORGAFSPRAAKID}

The variable ${ZORGAFSPRAAKID} is picked up by the linter as not assigned.

Solution I would like Take these suite variables into account in some way.

Additional context As an alternative I switched back to the Robocorp language server for the time being.

ElKabieri avatar Feb 01 '24 14:02 ElKabieri

Thanks for submitting this enhancement.

I'll have a look at it after RoboCon...

d-biehl avatar Feb 01 '24 17:02 d-biehl