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 |
这篇关于仅执行场景大纲中的特定示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:仅执行场景大纲中的特定示例
基础教程推荐
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01