簡體   English   中英

有沒有辦法在html報告中添加/打印自定義步驟/文本

[英]Is there any way to add/print custom step/text in html reports

我正在使用athaydes的spock報告。 我想在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 "
    }
}

現在,執行完成后,下面是報告的快照。

在此處輸入圖片說明

現在我的要求是,網頁上會生成一些收據編號,我希望在Then塊之后將其打印在html報告中。 (然后:“應生成接收號碼”)。 您能否指導我如何借助特定的geb / spock關鍵字或athaydes-spock-reports完成此操作。

我也從下面的站點引用了該材料,但是它對我不起作用。 https://github.com/renatoathaydes/spock-reports#how-to-use-it

感謝您的協助。

最終我獲得了成功,我相信我也找到了根本原因。

如果spec文件擴展到Specification ,則reportHeaderreportInfo關鍵字可以正常工作。

如果使用的是geb,則可以通過擴展GebReportingSpec來使用report() ,以獲取要添加到geb spock html報告中的自定義步驟。

謝謝,德吉什

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM