XML Библиотека Robot Framework

Введение

Документация

Официальная документация

Пример

robot_xml_demo/ ├── demo.xml └── tests └── robot └── test_demo.robot

<example> <first id="1">text</first> <second id="2"> <child/> </second> <third> <child>more text</child> <second id="child"/> <child><grandchild/></child> </third> <html> <p> Text with <b>bold</b> and <i>italics</i>. </p> </html> </example>

# test_demo.robot *** Settings *** Library XML Library Collections *** Variables *** ${XML}= demo.xml *** Test Cases *** Example ${root}= Parse XML ${XML} Should Be Equal ${root.tag} example ${first}= Get Element ${root} first Should Be Equal ${first.text} text Dictionary Should Contain Key ${first.attrib} id Element Text Should Be ${first} text Element Attribute Should Be ${first} id 1 Element Attribute Should Be ${root} id 1 xpath=first Element Attribute Should Be ${XML} id 1 xpath=first

Из директории robot_xml_demo выполним

python -m robot .\tests\robot\test_demo.robot

============================================================================== Test Demo ============================================================================== Read | PASS | ------------------------------------------------------------------------------ Test Demo | PASS | 1 test, 1 passed, 0 failed ==============================================================================

Article author: Andrei Olegovich

Похожие статьи
Operating System
RequestsLibrary
XML
Libraries
Robot Framework

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 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: