cancel
Showing results for 
Search instead for 
Did you mean: 

How to use extent-report in Ready API tool?

SOLVED
Highlighted
Moderator

Re: How to use extent-report in Ready API tool?

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. ⬇️⬇️⬇️
Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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

 

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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

Highlighted
Regular Contributor

Re: How to use extent-report in Ready API tool?

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

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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
Highlighted
Regular Contributor

Re: How to use extent-report in Ready API tool?

@VeJaay 

 

Appreciate if you can share the code here for project level 

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

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

Highlighted
Occasional Contributor

Re: How to use extent-report in Ready API tool?

@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.

       

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite