1, an internal variable (set variable);
Internal variable, is only effective in the present embodiment the inside, in other use cases invalid;
As shown below;
2, the global variable (Set Global Variable);
Global variables across the test set (Suite) effective, and only with the current definition of the variables and cases were effective after use;
So if you want to use all cases effective, global variables may be defined in the first use case;
Test Results:
Starting test: UItest programs.Test Suite.test2_global
20200317 16:25:48.755 : INFO : ${global_bar} = hello RF
20200317 16:25:48.755 : INFO : hello RF
Ending test: UItest programs.Test Suite.test2_global
2.1, before calling a global variable definition - will complain;
test1_var embodiment is defined before the global variable, so the error;
Test Results:
Starting test: UItest programs.Test Suite.test1_var
20200317 16:43:43.036 : INFO : ${var1} = hello python
20200317 16:43:43.036 : INFO : hello python
20200317 16:43:43.037 : FAIL : Variable '${global_bar}' not found.
Ending test: UItest programs.Test Suite.test1_var
2.2, global variables after calling --PASS defined;
test3_var embodiment is defined after the global variable, so the PASS;
Test Results:
Starting test: UItest programs.Test Suite.test3_global
20200317 16:43:43.041 : INFO : hello RF
Ending test: UItest programs.Test Suite.test3_global
2.3, global variable cross-Suite call --PASS after the definition;
test4_var test suite is Tset Suite2 following global variable defined by the following Example, so the PASS;
Test Results:
Starting test: UItest programs.Tset Suite2.test4_global
20200317 16:43:43.046 : INFO : hello RF
Ending test: UItest programs.Tset Suite2.test4_global
3、Suite变量(Set Suite Variable);
Only in this embodiment is defined by an effective Suite;
As shown below, test1_suite Suite defined variable test_var performed in the PASS;
But failed to execute another Suite in test2_suite;
Test Results:
Starting test: UItest programs.Test Suite.test1_suite
20200317 17:05:04.714 : INFO : ${suite_var} = Hello Suite
20200317 17:05:04.715 : INFO : Hello Suite
Ending test: UItest programs.Test Suite.test1_suite
Starting test: UItest programs.Test Suite.test_var
20200317 17:05:04.717 : INFO : Hello Suite
Ending test: UItest programs.Test Suite.test_var
Starting test: UItest programs.Tset Suite2.test2_suite
20200317 17:05:04.722 : FAIL : Variable '${suite_var}' not found.
Ending test: UItest programs.Tset Suite2.test2_suite