Execute only specific examples in a Scenario Outline(仅执行场景大纲中的特定示例)
问题描述
我们希望在我们的 Java 测试自动化框架中使用 Cucumber 更好地管理测试数据.对于Scenario Outline
,我们希望将测试参数按照它们将在其中运行的适用环境分类.例如,
We're looking to better manage test data using Cucumber in our Java test automation framework. For a Scenario Outline
, we're looking to tabulate test parameters categorized by the applicable environment in which they will run.
For example,
Scenario Outline: Login into application
Given I am on the homepage in the <environment>
When I enter my <user>
And I enter my <pass>
Then I am taken to the homepage
Examples:
|user |pass |environment|
|test |test1 |local |
|retest |retest1 |sit |
|prodtest|prodtest1|production |
因此,当上述场景在例如 SIT 环境中执行时,只会选择第二个示例,而不是第一个和第三个.
So, when the above scenario is executing in, for example, the SIT environment, only the 2nd example will be picked up, and not the first and third.
这个级别的执行可以完成吗?
Can this level of execution be accomplished?
推荐答案
您可以通过将示例表分成两个并在它们上使用标签来完成此操作...然后使用标签运行测试以过滤 cucumberoptions.
You can get this done by splitting up your examples table into two and using tags on them... Then run the test with the tags to filter in cucumberoptions.
@others
Examples:
|user |pass |environment|
|test |test1 |local |
|prodtest|prodtest1|production |
@sit
Examples:
|user |pass |environment|
|retest |retest1 |sit |
这篇关于仅执行场景大纲中的特定示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:仅执行场景大纲中的特定示例


- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 转换 ldap 日期 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 获取数字的最后一位 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01