Day 4--robot api with yaml: Use your python scripts as robot keywords
程序员文章站
2022-03-05 13:17:23
robot framework 与yaml第4天:编写你自己的keywords,将python文件作为robot keywrods...
目录
Add function to foreach python file by given path
Change the code for creating test keywords into functions
Write yourself keywords
This article is about using python scripts as robot keywords.
- Task one: import one python file
- Task two: import path which contain python files
Prepare
- create one file which contain keywords
- copy file to new files and put into one path
- modify yaml
Prepare keywords files
Modify yaml
Modify python scripts
- add function to foreach python file by given path
- change the code for creating test keywords into functions
Add function to foreach python file by given path
Change the code for creating test keywords into functions
outputs
If config assertions into yaml file will be better
If config assertions into yaml file will be better
If config assertions into yaml file will be better
==============================================================================
Activate Variable
==============================================================================
Should Activate Skynet | PASS |
------------------------------------------------------------------------------
Test self keyword | FAIL |
1 != 2
------------------------------------------------------------------------------
Test one keyword by path | FAIL |
1 != 2
------------------------------------------------------------------------------
Test other keywords by path | FAIL |
1 != 2
------------------------------------------------------------------------------
Activate Variable | FAIL |
4 critical tests, 1 passed, 3 failed
4 tests total, 1 passed, 3 failed
==============================================================================
Output: C:\make-your-robot-rest-api\day4\src\reports\skynet-output.xml
[Finished in 0.7s]
Whole python scripts
References
本文地址:https://blog.csdn.net/keithsoul/article/details/107653705