robotframework - 如何在机器人框架中实现自定义部分
问题描述
我们在 Robot Framework 中有如下部分:
***Settings***
***Variables***
***Test Cases***
***Keywords***
并且在运行文件机器人框架引擎时尝试找到TestCases并执行它。同样,是否可以创建一个自定义部分,比如General并且在运行类时执行定义的关键字/方法?
解决方案
It is not possible to add sections to a robot file. However, what you describe can be achieved using Robot Framework by filtering the test cased from the command line using Test Case Tags.
Given the following example:
*** Test Cases ***
Test Case General 1
[Tags] General
No Operation
Test Case General 2
[Tags] General
No Operation
Test Case Feature 1
[Tags] Feature 1
No Operation
Test Case Feature 2
[Tags] Feature 2
No Operation
Starting Robot framework with the argument:
--include General
Will result in
Test Case General 1 | PASS |
------------------------------------------------------------------------------
Test Case General 2 | PASS |
------------------------------------------------------------------------------
and
--include General --include Feature 2
Will result in
Test Case General 1 | PASS |
------------------------------------------------------------------------------
Test Case General 2 | PASS |
------------------------------------------------------------------------------
Test Case Feature 2 | PASS |
------------------------------------------------------------------------------
推荐阅读
- networking - 使用 DPDK 将数据包数据写入文件会导致丢包(即使流量速度 <200 Mbps)。瓶颈是什么?
- node.js - 如何为不和谐服务器制作“!踢”命令消息?
- node.js - 发生系统错误:uv_os_get_passwd 返回 ENOENT(没有这样的文件或目录)
- macos - 允许在 Safari 中下载多个文件
- python - `var = [ ... ]` 在 Python 中有什么作用?
- java - 从 JDK8 升级到 JDK11 后出现奇怪的 java.lang.InstantiationException 和 java.lang.NoSuchMethodException
- python-3.x - 从不同列中的唯一值创建 DataFrame 或字典
- xml - 在 Powershell 中将 xml 变量保存到文件会导致语法错误
- sql - 时间在周末和周末的情况
- c - 我收到此错误:分段错误(核心转储)