GithubHelp home page GithubHelp logo

Comments (4)

adam-wypych avatar adam-wypych commented on August 14, 2024

You are fully right that we do not propagate variables created by Set Global Variable/Set Suite Variable to test suite, test case or keyword from where it is executed. The main reason is that Robot Framework gives possibility to perform tests in different order i.e. by declare execution by specific tags, so if you will have example like below:

*** Test Cases ***
TestA
              [Tags]   Prepare
              Set Suite Variable       ${z}            10
TestB
              [Tags]    Exec
             Log           ${z}

and only tag Exec will be take in account during test perform, You will get an information about variable ${z} unknown.
Therefore for better visibility we have not been decided to implement some extra but still possible to failing mechanism of variable providing - equal to create robot test execution interpreter inside RED.

In my opinion tests are pretty the same like programming language, so you have in\out variables. For some special, but unlike global is good to have one place to check. Therefore I think You can use created variables in python file and import them to red.xml in Section Variable files. So in example:

GLOBAL_VARS.py

OBJECT = None

should make variable ${OBJECT} visible at whole project.
For suite variables is better to define them in

*** Variables  ***

section.

from red.

pkomarov avatar pkomarov commented on August 14, 2024

In a case, you described, I'm totaly agree with you. Moreover this is a bad practice, because TCs should be independent. But in a case, I've described this global variable is defined in a suite setup, which will be executed in any case. Is it possible to distinguish such a case?

from red.

KrzysztofJozefowicz avatar KrzysztofJozefowicz commented on August 14, 2024

This is a valid argument, we will discuss this among the team.
For now you can follow Adam advice to create sample python file variable and add it to red.xml in variable files section so it will be visible around project without changing testcases itself.

from red.

michalanglart avatar michalanglart commented on August 14, 2024

The case:

*** Settings ***
Suite Setup    Set Global Variable    ${X}    1
*** Test Cases ***
test
   Log    ${X}

is covered. We are not willing to push it further and look inside custom keywords used as a setup in order to check if they eventually call Set Global Variable.

from red.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.