[Python] Dynamic Allocation or Declaration of Robot Framework Variables

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I have a script that automatically generates Robot Framework testcases based on a few parameters. Now in this generated testcases there might a ssh connection or some other things that has predefined values and were used in multiple places.

    For reference,

    *** Test Case ***

    Verify Same Value Usage Without Variables
    Log Hello World
    Should Be Equal Hello World Hello World
    Comment This test repeats "Hello World" without using variables
    Log Hello World
    Should Contain Hello World World



    I want this values to be allocated using a variable name and replace the value with the variable throughout the test suite and make this like:

    *** Variables ***
    ${MESSAGE} Hello World

    *** Test Case ***
    Verify Same Value Usage With Variable
    Log ${MESSAGE}
    Should Be Equal ${MESSAGE} ${MESSAGE}
    Comment This test uses the variable ${MESSAGE}
    Log ${MESSAGE}
    Should Contain ${MESSAGE} World



    Is that possible through a script?

    I have found no solution for this yet. Any ideas will be more than welcome!

    Continue reading...

Compartilhe esta Página