html tool

2017年10月25日星期三

robotframe 内嵌关键字的用法补遗V

http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Run%20Keyword%20If%20Any%20Critical%20Tests%20Failed

${all_var}= Get Variables
Log Many ${all_var}
Get Variablesno_decoration=False
Returns a dictionary containing all variables in the current scope.
Variables are returned as a special dictionary that allows accessing variables in space, case, and underscore insensitive manner similarly as accessing variables in the test data. This dictionary supports all same operations as normal Python dictionaries and, for example, Collections library can be used to access or modify it. Modifying the returned dictionary has no effect on the variables available in the current scope.
By default variables are returned with ${}, @{} or &{} decoration based on variable types. Giving a true value (see Boolean arguments) to the optional argument no_decoration will return the variables without the decoration. This option is new in Robot Framework 2.9.
Example:
${example_variable} = Set Variable example value ${variables} = Get Variables Dictionary Should Contain Key ${variables} \${example_variable} Dictionary Should Contain Key ${variables} \${ExampleVariable} Set To Dictionary ${variables} \${name} value Variable Should Not Exist \${name} ${no decoration} = Get Variables no_decoration=Yes Dictionary Should Contain Key ${no decoration} example_variable
Note: Prior to Robot Framework 2.7.4 variables were returned as a custom object that did not support all dictionary methods.
Import Library ${LIBRARIES}/Lib.javaImport Libraryname, *args
Imports a library with the given name and optional arguments.
This functionality allows dynamic importing of libraries while tests are running. That may be necessary, if the library itself is dynamic and not yet available when test data is processed. In a normal case, libraries should be imported using the Library setting in the Setting table.
This keyword supports importing libraries both using library names and physical paths. When paths are used, they must be given in absolute format or found from search path. Forward slashes can be used as path separators in all operating systems.
It is possible to pass arguments to the imported library and also named argument syntax works if the library supports it. WITH NAME syntax can be used to give a custom name to the imported library.
Examples:
Import Library MyLibrary Import Library ${CURDIR}/../Library.py arg1 named=arg2 Import Library ${LIBRARIES}/Lib.java arg WITH NAME JavaLib
Import Resource ${CURDIR}/new.txt
lognameaaa ${test_map}
Import Resourcepath
Import Variables ${CURDIR}/test.py
logname ${test_map}
Import Variablespath, *args
检查keyword是否存在Keyword Should Existname, msg=None
Length Should Be abcdefg 7Length Should Beitem, length,msg=None
Log ****hi logLogmessage, level=INFO,html=False,console=False,repr=False
Logs the given message with the given level.
Valid levels are TRACE, DEBUG, INFO (default), HTML, WARN, and ERROR. Messages below the current active log level are ignored. See Set Log Level keyword and --loglevel command line option for more details about setting the level.
Messages logged with the WARN or ERROR levels will be automatically visible also in the console and in the Test Execution Errors section in the log file.
Logging can be configured using optional html, console and repr arguments. They are off by default, but can be enabled by giving them a true value. See Boolean arguments section for more information about true and false values.
If the html argument is given a true value, the message will be considered HTML and special characters such as < in it are not escaped. For example, logging creates an image when html is true, but otherwise the message is that exact string. An alternative to using the html argument is using the HTML pseudo log level. It logs the message as HTML using the INFO level.
If the console argument is true, the message will be written to the console where test execution was started from in addition to the log file. This keyword always uses the standard output stream and adds a newline after the written message. Use Log To Console instead if either of these is undesirable,
If the repr argument is true, the given item will be passed through a custom version of Python's pprint.pformat() function before logging it. This is useful, for example, when working with strings or bytes containing invisible characters, or when working with nested data structures. The custom version differs from the standard one so that it omits the u prefix from Unicode strings and adds b prefix to byte strings.
Examples:
Log Hello, world! # Normal INFO message. Log Warning, world! WARN # Warning. Log Hello, world! html=yes # INFO message as HTML. Log Hello, world! HTML # Same as above. Log Hello, world! DEBUG html=true # DEBUG as HTML. Log Hello, console! console=yes # Log also to the console. Log Hyvä \x00 repr=yes # Log 'Hyv\xe4 \x00'.
See Log Many if you want to log multiple messages in one go, and Log To Console if you only want to write to the console.
Arguments html, console, and repr are new in Robot Framework 2.8.2.
Pprint support when repr is used is new in Robot Framework 2.8.6, and it was changed to drop the u prefix and add the b prefix in Robot Framework 2.9.
Log Many ******${var} DEBUG aaaaT
打印多个值的log
Log Many*messages
Logs the given messages as separate entries using the INFO level.
Supports also logging list and dictionary variable items individually.
Examples:
Log Many Hello ${var} Log Many @{list} &{dict}
See Log and Log To Console keywords if you want to use alternative log levels, use HTML, or log to the console.

Log To Console Hell try Log To Console
Log To Console Hell try Log To Console STDERR STDERR
PS: 屏幕输出 很好用的和 Log 有相同的效果
Log To Consolemessage,stream=STDOUT,no_newline=False
Logs the given message to the console.
By default uses the standard output stream. Using the standard error stream is possibly by giving the stream argument value STDERR (case-insensitive).
By default appends a newline to the logged message. This can be disabled by giving the no_newline argument a true value (see Boolean arguments).
Examples:
Log To Console Hello, console! Log To Console Hello, stderr! STDERR Log To Console Message starts here and is no_newline=true Log To Console continued without newline.
This keyword does not log the message to the normal log file. Use Log keyword, possibly with argument console, if that is desired.
New in Robot Framework 2.8.2.

没有评论:

发表评论