[英]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.