Подключить переменные из .py файла в Robot Framework

Содержание
Введение
Пример
Похожие статьи

Введение

В этой статье вы можете увидеть пример импорта переменных из внешнего Python файла.

В сам тест будет подключен .resource файл, а уже в нём в качестве Variables будет подключен .py файл

Пример

В этом примере вы можете увидеть как из одного .resource файла можно получить переменные как из блока Variables так и из блока Settings

demo |-- Libraries |-- Resources | |-- demo.resource | `-- my_vars.py `-- Tests `-- demo.robot

demo.robot

*** Settings *** Resource ../Resources/demo.resource *** Test Cases *** Using Var From Python File Log To Console \n OUTPUT: Log To Console ${URL} Log To Console ${HOSTING}

demo.resource

*** Settings *** Variables my_vars.py *** Variables *** ${HOSTING}= https://beget.com

my_vars.py

URL = "https://devhops.ru"

robot demo.robot

============================================================================== Demo ============================================================================== Using Var From Python File OUTPUT: .https://devhops.ru .https://beget.com Using Var From Python File | PASS | ------------------------------------------------------------------------------ Demo | PASS | 1 test, 1 passed, 0 failed ============================================================================== Output: C:\Users\Andrei\robot\demo\Tests\output.xml Log: C:\Users\Andrei\robot\demo\Tests\log.html Report: C:\Users\Andrei\robot\demo\Tests\report.html

Article author: Andrei Olegovich

Похожие статьи
Robot Framework
Declare a variable
Change a variable value
Get Variable Value
Passing arguments to a keyword
Evaluate
PyCharm

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: