简体   繁体   English

如何获取当前执行的Cucumber测试方案标题和步骤文本

[英]How to get currently executed Cucumber test scenario title and step text

Thanks for help in advance. 预先感谢您的帮助。 I'm looking for a way how I can retrieve currently executed test scenario and step from ruby. 我正在寻找一种方法来检索当前执行的测试方案并从ruby中逐步执行。 I've been trying to find a way but been rather unsuccessful. 我一直在尝试找到一种方法,但是却没有成功。

I know that for most uses it's not very common, but I would like to experiment with few ideas and I really need to get this kind of information. 我知道对于大多数用途来说,这不是很常见,但是我想尝试一些想法,所以我确实需要获取此类信息。

You can use Scenario Hooks to get steps for each scenario: 您可以使用方案挂钩来获取每种方案的步骤:

After do |scenario|
  scenario.steps.each { |s| puts s.to_sexp }
end

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 黄瓜:在每种情况下如何获取已执行步骤的列表? - Cucumber: How to get list of executed steps after each scenario? Cucumber:如何打印/获取所有已执行场景计数,状态为“执行报告 - 总计:5,通过:4,失败:1” - Cucumber : How to print/get all the executed scenario count with status like "Execution Report - Total: 5, passed: 4, failed: 1" 如何使用Cucumber 1.3.17获取Cucumber场景的步骤列表? - How to get the steps list of a Cucumber scenario with Cucumber 1.3.17? 如何使步骤定义文件中的步骤失败,以便在黄瓜水豚环境中将场景自动标记为失败? - How to fail a step in step definition file so that scenario is automatically marked as failed in cucumber-capybara environment? 黄瓜-如何在单个方案中测试多个“然后”条件? - Cucumber - How to test for multiple “Then” conditions within a single Scenario? 挂钩后在黄瓜中访问场景标题和示例 - Accessing the Scenario Title and Example in a Cucumber After hook 黄瓜和红宝石:打印执行的每个步骤 - Cucumber and ruby: print every step executed 如何使黄瓜测试中的“方案大纲”中的“示例”中的多行字符串起作用? - How to get multiline strings in Examples in Scenario Outline in cucumber tests to work? 如何在黄瓜中划分功能和场景? - How to divide feature and scenario in Cucumber? 在 RubyMine 中运行 Cucumber 测试场景时出错 - Error when running Cucumber test scenario in RubyMine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM