【问题标题】:How to embed text into cucumber report with ruby?如何使用 ruby​​ 将文本嵌入到黄瓜报告中?
【发布时间】:2019-12-24 11:23:30
【问题描述】:

如何使用 ruby​​ 将文本嵌入到黄瓜报告中。我们可以通过使用下面的代码使用 java 来做到这一点,但同样我如何在 cucumber-ruby 中做到这一点?

我尝试过使用嵌入方法,但它不起作用。

下面是在java中写入文本以报告的代码。

来源:https://gist.github.com/aslakhellesoy/4072962

import cucumber.api.Scenario;

public class MyStepdefs {
    private Scenario scenario;

    @Before
    public void before(Scenario scenario) {
        this.scenario = scenario;
    }

    @Given("^I have (\\d+) cukes in my belly$")
    public void cukes_in_my_belly(int cukes) {
        scenario.write("This goes into the report(s)\n");
    }
}

【问题讨论】:

    标签: ruby cucumber watir page-object-gem


    【解决方案1】:

    我得到了解决方案,只需打印如下值:

    Given("I have {int} cukes in my belly") do |cukes|
     puts 'This goes into the report: #{cukes}'
    end
    

    【讨论】:

      猜你喜欢
      • 2017-06-10
      • 2021-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 2019-08-02
      相关资源
      最近更新 更多