【问题标题】:Is there any way to add/print custom step/text in html reports有没有办法在 html 报告中添加/打印自定义步骤/文本
【发布时间】:2018-10-31 17:52:27
【问题描述】:

我正在使用 athaydes spock-reports。我想在 html 报告中插入一些特定的输出文本。为此,请参阅以下我迄今为止使用过的东西。 以下是我的规格文件:

@Stepwise
class TC001_SMO_Scenario_Spec extends GebReportingSpec {
def "Step 1:Go to the login page of the WU"() {

        when: "User open the Login page"
        to LoginPage

        then: "Login page should get open"
        at LoginPage

        when: "User enters credentials"
        page.Login()

        then: "Home Page should get open"
        at HomePage
    }

    def "Step 2:User initiates transfer process"() {

        when: "Clicks on the Start New Transfer button"
        page.selectionOfItem()
        sleep(2000)

        then: "Reciept Number should be generated"
        at ManageConnections
        def recieptNumber =  tabConnections.text()
        reportInfo(recieptNumber )       
        reportInfo " Reciept Number is $recieptNumber "
    }
}

现在执行完成后,下面是报告的快照。

现在我的要求是,在网页上生成了一些收据编号,我希望将其打印在 html 报告中,在 Then 块之后。 (然后:“应生成收据编号”)。 您能否指导我如何在特定的 geb/spock 关键字或 athaydes - spock-reports 的帮助下完成此操作。

我也参考了以下站点的材料,但它对我不起作用。 https://github.com/renatoathaydes/spock-reports#how-to-use-it

感谢您对此的帮助。

【问题讨论】:

  • 我的用例是什么?如果您需要证明测试以正确的方式执行,您可以截屏...

标签: spock geb spock-reports


【解决方案1】:

我终于成功了,我相信我也找到了根本原因。

如果规范文件扩展至Specification,则reportHeaderreportInfo 关键字工作正常。

如果您使用 geb,通过扩展 GebReportingSpec,则需要使用 report() 来获取要添加到 geb spock html 报告中的自定义步骤。

谢谢, Durgesh

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-01
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 1970-01-01
    • 2010-09-24
    • 2011-05-26
    • 2020-03-04
    相关资源
    最近更新 更多