Оператор in в Robot Framework
| Введение | |
| Пример | |
| Похожие статьи |
Введение
С помощью in можно проверить входит ли такой объект в
список
или нет.
Такой оператор присутствует в
Python
и других языках программирования.
in отделяется отступами в один пробел
$var in $list
Пример
Рассмотрим тест in.robot
*** Settings *** Documentation Testing in operator Test Setup Log To Console "Starting Test Case" Test Teardown Log To Console "Finishing Test Case" *** Variables *** @{versions}= 18 19 20 21 ${current_version}= 21 *** Keywords *** Compare Versions Log To Console ${current_version} Should Be True $current_version in $versions ... Expected `${current_version}` to be in `${versions}`, got False` *** Test Cases *** Verify that in is working [Documentation] This test case verifies that "in" can be used [Tags] Functional Compare Versions
robot in.robot
============================================================================== Example :: Testing in operator ============================================================================== Verify that in is working :: This test case verifies that "in" can... "Starting Test Case" .21 ."Finishing Test Case" Verify that in is working :: This test case verifies that "in" can... | PASS | ------------------------------------------------------------------------------ Example :: Testing in operator | PASS | 1 test, 1 passed, 0 failed ============================================================================== Output: /home/andrei/tests/Example/output.xml Log: /home/andrei/tests/Example/log.html Report: /home/andrei/tests/Example/report.html
Автор статьи: Андрей Олегович
| Collections: списки, словари | |
| Кортежи | |
| Словари | |
| Списки | |
| in | |
| Строки | |
| Библиотеки |