Day 5--robot api with yaml: suite setup and teardown

本文探讨了在RobotFramework中使用YAML配置进行测试用例的设置与解析,重点介绍了如何在测试套件中设置变量,以及创建自定义关键字的过程。文章强调了正确配置的重要性,避免常见错误如关键字类型误设于测试案例中,以及同名关键字造成的测试案例无关键字问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

 

Write yourself keywords

Attentions

Parsing config steps and create suite keywords

Create simple keywords

Yaml example

outputs

Whole python scripts

References


Write yourself keywords

This article is about setup and teardown in suite.

Attentions

  • If you want to setup variables in suite, use set_suite_variable
  • Remove keyword type in testcase
  • If have multiple keywords with same name will cause: test case contains no keywords when create yourself keywords.

Parsing config steps and create suite keywords

# 
suite_steps = configs.get('steps')
create_case_step(suite, suite_steps)

Create simple keywords

Yaml example

outputs

If config assertions into yaml file will be better
==============================================================================
Activate Variable                                                             
==============================================================================
Should Activate Skynet                                                | PASS |
------------------------------------------------------------------------------
Test self keyword                                                     | PASS |
------------------------------------------------------------------------------
Activate Variable                                                     | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output:  C:\make-your-robot-rest-api\day5\src\reports\skynet-output.xml
[Finished in 0.6s]

Whole python scripts

References

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值