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

@VeJaay 

 

I am also having simmilar setup like surendermcard 

I have almost 15 test suites and each testsuites has test cases i need to project level report where it can show like test suite and test cases 

 

appreciate any help 

678
Regular Contributor

@VeJaay 

 

Any Update here ?

kgbheem
Occasional Contributor

try this...use globalProperties.setPropertyValuein the setup script at project level and then in the test suite level

use globalProperties.getPropertyValue( "reportPath" )

 

def reportname=com.eviware.soapui.SoapUI.globalProperties.setPropertyValue("reportPath", path)

def path = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "reportPath" )

 

hope this helps

Chakriy17
Occasional Contributor

Hi Bheem,

I have generated the extent report

Please find the attachment for the generated extent report.

But  i am unable to get the testSteps present in the Testcase

How to get the Teststeps present in the testcase and also corrresponding assertion should be displayed for the teststep.

 

Please help me in this, required for the client 

Will be waiting for your reply.

Thanks in Advance

ChakriExtentreport.png

VeJaay
Occasional Contributor

Sadly no 😞 


@678 wrote:

@VeJaay 

 

Any Update here ?


 

VeJaay
Occasional Contributor

For that you have to write logic to get the test steps and the assertions associated in them.. I dont have the code for that  but its not that tough to find it online... 

I'll share if  I have some working code 

 

Chakriy17
Occasional Contributor

Hi Vejeey

 

Please do share the working code to atleast get the Teststeps present in the Testcase and to be displayed in the extent report so that would be helpful.

Thanks

chakri

Chakriy17
Occasional Contributor

Hi Bheem,

I have generated the extent report

Please find the attachment for the generated extent report.

But  i am unable to get the testSteps present in the Testcase

How to get the Teststeps present in the testcase along with Status, Time Stamp and Details.

 

Please help me in this, required for the client 

Will be waiting for your reply.

Thanks in Advance

Chakri

kgbheem
Occasional Contributor

Try this

// This will get the list of all testSteps in the testCase
def testSteps = context.testCase.getTestStepList()
testSteps.each{
// This block will loop through the test steps and print the test step name to the log
log.info(it.name)
}
Chakriy17
Occasional Contributor

Capture.PNGimport 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 LogStatus = com.relevantcodes.extentreports.LogStatus; def path = "C://Users//chakradharyadav.m//Desktop//SampleReport//Extent_Reports//API_Testing_"+start_time+".html" log.info(path) def failedTestCase = 0; def extent = new ExtentReports(path,false) extent.addSystemInfo("Report Name", "API Test Automation").addSystemInfo("Report Type", "Automation Report"); runner.results.each { testCaseResult -> def name = testCaseResult.testCase.name log.info name // This will get the list of all testSteps in the testCase def testSteps = context.testCase.getTestStepList() testSteps.each{ // This block will loop through the test steps and print the test step name to the log log.info(it.name) } def extentTest = extent.startTest("$name", "$name") if(testCaseResult.status.toString() == 'FAILED') { failedTestCase++ extentTest.log(LogStatus.FAIL,testSteps, testCaseResult.testCase.name) } else { extentTest.log(LogStatus.PASS,testSteps, testCaseResult.testCase.name) } extent.endTest(extentTest); } extent.flush();

 

 

When i execute the code after adding the teststeps extent report is blank.

 

Please guide me for add the teststeps present in the testcase for the extent report

Thanks in advance

will be awaiting for the reply

 

Thanks

chakri

 

cancel
Showing results for 
Search instead for 
Did you mean: