robotframework - create dictionary 操作

1, create a dictionary

2, acquired from the dictionary entries - print out item

3, get a dictionary key - print out the key

4, get a dictionary value - print out the value

5, to obtain the dictionary key, value

6, print out the dictionary corresponding to the key value defined

 Specifies to run the robot kit in a case: in the file directory, run robot robot --test dict Base_Key.robot

Description: dict - as a test case

           Base_Key.robot -- 为 test suite

Test suite can be divided into directories and files, but test cases must be created in the file, directory can not create a test case, you can only create test suites

 

If you add the library does not exist or library name wrong, will be displayed in red, black normally indicates a normal library.
If you are in the "test suite" added to the library, then the keyword library can be provided in current use cases in the test suite
used.
If you add in a "test project" in the library of test cases under the current project can not use the library keywords, you need to use cases with
adding the library again should "test kit" in.

 

In Base_Key - Settings - Library - Enter a description of Collections red font does not appear that there Liability library

dict
${dict} Create Dictionary a 1 b 2
${item} Get Dictionary Items ${dict}
log ${item}
${key} Get Dictionary Keys ${dict}
log ${key}
${value} Get Dictionary Values ${dict}
log ${value}
${v} Get From Dictionary ${dict} b
log ${v}

 

The following is a robot operating results:

Starting test: Rf Test Pro.Base Key.dict
20190622 20:52:20.749 : INFO : ${dict} = {'a': '1', 'b': '2'}
20190622 20:52:20.751 : INFO : ${item} = ['a', '1', 'b', '2']
20190622 20:52:20.752 : INFO : ['a', '1', 'b', '2']
20190622 20:52:20.753 : INFO : ${key} = ['a', 'b']
20190622 20:52:20.754 : INFO : ['a', 'b']
20190622 20:52:20.756 : INFO : ${value} = ['1', '2']
20190622 20:52:20.757 : INFO : ['1', '2']
20190622 20:52:20.758 : INFO : ${v} = 2
20190622 20:52:20.760 : INFO : 2
Ending test: Rf Test Pro.Base Key.dict

 

 

Guess you like

Origin www.cnblogs.com/Teachertao/p/11070330.html