欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Day 4--robot api with yaml: Use your python scripts as robot keywords

程序员文章站 2022-06-18 21:07:40
robot framework 与yaml第4天:编写你自己的keywords,将python文件作为robot keywrods...

目录

 

Write yourself keywords

Prepare

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

outputs

Whole python scripts

References


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

Day 4--robot api with yaml: Use your python scripts as robot keywords

Modify yaml

Day 4--robot api with yaml: Use your python scripts as robot keywords

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

Day 4--robot api with yaml: Use your python scripts as robot keywords

Change the code for creating test keywords into functions

Day 4--robot api with yaml: Use your python scripts as robot keywords

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

Day 4--robot api with yaml: Use your python scripts as robot keywords

References

本文地址:https://blog.csdn.net/keithsoul/article/details/107653705