Forum Discussion

avidCoder's avatar
avidCoder
Super Contributor
7 years ago

How to use extent-report in Ready API tool?

I want to use extent-report for reporting purpose in ready api. I have downloaded extentreport jar file and added it in to external and lib folder of ready api. Can anybody give me basic code implementation for this?

  • VeJaay's avatar
    VeJaay
    6 years ago

    Please find the steps : Download the Extent API Jars from the following path : https://jar-download.com/artifacts/com.relevantcodes/extentreports and place it in the \bin\ext folder and try it

     

    Groovy code for extent report : 

    import com.relevantcodes.extentreports.ExtentReports; 
    import com.relevantcodes.extentreports.ExtentTest; 
    import java.text.SimpleDateFormat
    def date = new Date() 
    sdf = new SimpleDateFormat("dd_MM_yyyy_HHmmss") 
    def start_time = sdf.format(date) 
    log.info(start_time) 
    def path = "D://report_001//SampleReport//API_Testing_"+start_time+".html"
    log.info(path) def LogStatus = com.relevantcodes.extentreports.LogStatus; def failedTestCase = 0; def extent = new ExtentReports(path,false) extent.addSystemInfo("Report Name", "TestReport").addSystemInfo("Report Type", "Automation Report"); runner.results.each {
    testCaseResult -> def name = testCaseResult.testCase.name
    log.info name
    def extentTest = extent.startTest("$name", "$name") if(testCaseResult.status.toString() == 'FAILED') { failedTestCase++ extentTest.log(LogStatus.FAIL, testCaseResult.testCase.name) } else { extentTest.log(LogStatus.PASS, testCaseResult.testCase.name) } extent.endTest(extentTest); } extent.flush();

     

    Note : It worked for me in SOAP UI version 5.1 and greater ... not with older ones

  • Santhi1's avatar
    Santhi1
    New Contributor

    Hi, Have you tried with the extent-report in Ready API? Because I am also looking help for the extent report process in ReadyAPI for test result purpose

    • kgbheem's avatar
      kgbheem
      Occasional Contributor

      im able to implement extent report.. let me know if you need help

      • VeJaay's avatar
        VeJaay
        Occasional Contributor

        Hi,

         

        Can you please list down the steps to configure and generate Extenent Report ?

          

        I have downloaded the extent report jars and placed them in the path.

         

        Then added the following code in the Tear Down script :

         

        import com.relevantcodes.extentreports.ExtentReports;
        import com.relevantcodes.extentreports.ExtentTest;
        import com.relevantcodes.extentreports.LogStatus;

        def failedTestCase = 0;
        def extent = new ExtentReports("D:\\report_001\\SampleReport.html",true)
        runner.results.each {
        testCaseResult -> def name = testCaseResult.testCase.name
        def extentTest = extent.startTest(name, name)
        if(testCaseResult.status.toString() == 'FAILED'){
        failedTestCase++
        extentTest.log(LogStatus.FAIL, testCaseResult.testCase.name)
        } else {
        extentTest.log(LogStatus.PASS, testCaseResult.testCase.name)
        }

        }

         

         

        But nothing happens. Not even a file is created in the location nor any error is thrown.

         

        Thanks in advance.

        VeJaay.