Ask a Question

How to use extent-report in Ready API tool?

SOLVED
avidCoder
Super Contributor

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?

40 REPLIES 40
nmrao
Champion Level 3

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
Occasional Contributor

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

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.

surendermcard
Occasional Contributor

Hi @kgbheem 

Can you please help me out how you have implemented extent report with readapi tests.

If you can provide me the groovy code snippet that will help.

 

Thanks

Surender

VeJaay
Occasional Contributor

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

surendermcard
Occasional Contributor

I have added the required jars and  tried this groovy code ReadyAPI 2.6.0. Its throwing me following error at line 14 of groovy code which you provided i.e at 'runner.results.each {'

 

Mon Apr 22 18:58:22 IST 2019: ERROR: An error occurred in the script of the Groovy Script test step [Groovy Script]:
Mon Apr 22 18:58:22 IST 2019: ERROR: groovy.lang.MissingPropertyException: No such property: runner for class: Script1
   groovy.lang.MissingPropertyException: No such property: runner for class: Script1
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
    at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
    at Script1.run(Script1.groovy:14)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:98)
    at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:158)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:261)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:50)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:171)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:1)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:130)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
 
 
Can you help me on this?

 

kgbheem
Occasional Contributor

Hi pal,
I’m out of town. I will be back by Wednesday. We can connect on that day and fix it
Thanks
Bheem
surendermcard
Occasional Contributor

Sure Bheem.

 

Thanks

Surender

cancel
Showing results for 
Search instead for 
Did you mean: