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

2022-07-31,,,,

目录

 

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

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

  • robot api with yaml
  • Useful links
  • Suite import library

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

《Day 4--robot api with yaml: Use your python scripts as robot keywords.doc》

下载本文的Word格式文档,以方便收藏与打印。