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
Nastya_Khovrina
SmartBear Alumni (Retired)

Hi @surendermcard,

 

The script works for me if I place it in the TearDown script on the Test Suite level.

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
kgbheem
Occasional Contributor

@surendermcard : what is the error you are seeing while running it for project level?

Chakriy17
Occasional Contributor

Hi, I am trying to generate to generate the extent report using the following code.

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();

But i am facing issue at the line
runner.results.each

stating that "No such property"
Can any one please help me
Thanks in advance

 

VeJaay
Occasional Contributor

Place the code in the Tear Down suite of the Test Suite and you will not get this error. If you place in Project level Tear down you will face the error

678
Regular Contributor

How to get this work on Project Level, its working on TestSuite Level but required on Project level 

VeJaay
Occasional Contributor

To make it run at a project level , you must change the logic behind getting the report... My understanding is 

runner.results.each --- > This works only in suit level. So need to store the report params in a temp file and write them to the final report in the project level
678
Regular Contributor

@VeJaay 

 

Appreciate if you can share the code here for project level 

surendermcard
Occasional Contributor

@VeJaay , please share the code if possible for project level.

VeJaay
Occasional Contributor

Hey @surendermcard  and @678  I am trying the same. Will post if it turns out fine... Just on question though any specific reason to get the report at proejct level ? Coz I personally find it easy to maintin in the Suite level. I will get a working solution and update here.

 

If possible please list down what steps does your project have ?  Like Groovy SOAP /Rest , JDBC etc...

surendermcard
Occasional Contributor

@VeJaay , I want to place groovy script at just project level because my READYAPI project has different test suites so don't want to place groovy script for each test suite, instead just want to place script at project level so that it can generate report for all test suites(and test cases inside) in one go.

Following is the structure of the project:-

 

READYAPIProject(Groovy Script at this level)

     TestSuite1

            TestCase1

                 TestStep1(Like SOAP/REST/JDBC etc. request)

                 TestStep2

                  .................

            TestCase2

                  TestStep1

                  ............

      TestSuite2

      ...........................................

 

I am also working on the groovy code at project level.

       

cancel
Showing results for 
Search instead for 
Did you mean: