RST
Введение
Тесты могут быть написаны в формате reStructuredText. То есть один и тот же документ, напримре как
QuickStart.rst
в проекте
QuickStart
служит и документацией как, например
README.md файлы
и тестами как нормальный .robot файл.
Выглядит это как
Текст текст текст .. code:: robotframework код код Текст текст текст
Удобно для написания документации. Крайне неудобно когда нужно почитать код. Возможно те кто пользуется этим форматом знают какие-то хитрости, неизвестные мне. Если вы из этих - напишите в телеграм .
Ниже отрывок кода QuickStart.rst
Data-driven tests ----------------- Quite often several test cases are otherwise similar but they have slightly different input or output data. In these situations *data-driven tests* allows varying the test data without duplicating the workflow. With Robot Framework the `[Template]` setting turns a test case into a data-driven test where the template keyword is executed using the data defined in the test case body: .. code:: robotframework *** Test Cases *** Invalid password [Template] Creating user with invalid password should fail abCD5 ${PWD INVALID LENGTH} abCD567890123 ${PWD INVALID LENGTH} 123DEFG ${PWD INVALID CONTENT} abcd56789 ${PWD INVALID CONTENT} AbCdEfGh ${PWD INVALID CONTENT} abCD56+ ${PWD INVALID CONTENT} In addition to using the `[Template]` setting with individual tests, it would be possible to use the `Test Template` setting once in the settings table like `setups and teardowns`_ defined later in this guide. In our case that
Для составления документации, это доволько удобно, но читать тесты в документе полном текстовых абзацев гораздо сложнее, чем в обычном .robot файле
Пример
Demo of rst .. code:: robotframework *** Variables *** ${WEBSITE} www.devhops.ru Some text that explains how you can write docs between robot code lines .. code:: robotframework *** Test Cases *** My Test [Documentation] Logs Website URL Log To Console ${WEBSITE}x Final words about placing Settings at the end of the file .. code:: robotframework *** Settings *** Documentation reStructuredText demo Thanks for your attention
Автор статьи: Андрей Олегович
Robot Framework | |
Основы | |
Тест логина | |
Пустые поля | |
reStructuredText | |
QuickStart | |
Robot из Python |