robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
168 stars 13 forks source link

[ENHANCEMENT] Allow for dynamically set suite variables #210

Open ElKabieri opened 5 months ago

ElKabieri commented 5 months ago

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.

d-biehl commented 5 months ago

Thanks for submitting this enhancement.

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