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 impleme...
  • 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