cancel
Showing results for 
Search instead for 
Did you mean: 

ExtenrtReport for ReadyAPI v3.x

SOLVED
Highlighted
New Contributor

ExtenrtReport for ReadyAPI v3.x

Please help me to integrate extentreport with ReadyAPI v3.x. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Thank you Himanshu🙂

 

@ashsharma22 Did you manage to complete this task?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

3 REPLIES 3
Highlighted
Community Leader

@ashsharma22 : You can use below link for the extent report integration with ReadyAPI

 

https://community.smartbear.com/t5/SoapUI-Pro/How-to-use-extent-report-in-Ready-API-tool/td-p/155680


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Community Manager

Thank you Himanshu🙂

 

@ashsharma22 Did you manage to complete this task?


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

Highlighted
New Contributor

Thanks Himanshu for the help!

 

I did few more modification in the script and made it dynamic. 

 

Step1: Only below imports needed

Step2: Add TestReport property at project level: ${projectDir}/TestReport; This location all extents reports will be stored

Step3: keep this code at suite level

Run it; 

 

 

 

import java.io.File;
import java.util.Date;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.Protocol;
import com.aventstack.extentreports.reporter.configuration.Theme;

log.info "start"

ExtentReports extent;
ExtentTest extentTest;


def testReport = context.expand( '${#Project#TestReport}' )
assert !testReport.equals(''), 'TestReport location not found'
log.info "testReport: "+testReport

if (extent == null) {
//ExtentReport file name
Date d=new Date();
String fileName=d.toString().replace(":", "_").replace(" ", "_")+".html";
//String folderName="C:\\reports\\";

File folderPath=new File(testReport);
if(!folderPath.exists()) {
log.info "Directory created"
folderPath.mkdir();
} else
log.info "Directory already exists"

String htmlFilePath=testReport+'/'+fileName;
log.info 'HTML File Path' + htmlFilePath


ExtentHtmlReporter htmlReporter=new ExtentHtmlReporter(htmlFilePath);
extent=new ExtentReports();
extent.attachReporter(htmlReporter);

htmlReporter.config().setCSS("css-string");
htmlReporter.config().setDocumentTitle("Automation Execution Report");
htmlReporter.config().setReportName("Test Automation Report");
htmlReporter.config().setEncoding("utf-8");
htmlReporter.config().setJS("js-string");
htmlReporter.config().setProtocol(Protocol.HTTPS);
htmlReporter.config().setReportName("build name");
htmlReporter.config().setTheme(Theme.STANDARD);
htmlReporter.config().setTimeStampFormat("MMM dd, yyyy HH:mm:ss");
}
for ( testCaseResult in runner.results ) {
// Getting all test cases’ names from the suite.
testCaseName = testCaseResult.getTestCase().name
extentTest = extent.createTest(testCaseName);

// Checking whether the case has PASSED.
if ( testCaseResult.getStatus().toString() == 'PASS' ) {
// Logging passed cases and test steps’ resulting messages.
extentTest.log(Status.PASS, testCaseName);
log.info "$testCaseName has passed"
for ( testStepResult in testCaseResult.getResults() ) {
testStepResult.messages.each() {
msg -> log.info msg
extentTest.log(Status.INFO, msg);
}
}
}

// Checking whether the case has failed.
if ( testCaseResult.getStatus().toString() == 'FAIL' ) {
// Logging failed cases and test steps’ resulting messages.
log.info "$testCaseName has failed"
extentTest.log(Status.FAIL, testCaseName);
for (testStepResult in testCaseResult.getResults() ) {
testStepResult.messages.each() {
msg -> log.info msg
extentTest.log(Status.INFO, msg);
}

}
}
}
extent.flush();

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors