From f50d597bae7f27a9f76a5ba8c77710deaff70c30 Mon Sep 17 00:00:00 2001 From: Akshay Sharma Date: Mon, 16 Oct 2023 19:53:44 +0530 Subject: [PATCH 1/2] Fixed code for #17 and simplified package name --- Listener-XML/soapuiextentter-listeners.xml | 6 ++-- .../dataproviderUtils}/CSVReader.java | 2 +- .../dataproviderUtils}/ExcelReader.java | 2 +- .../dataproviderUtils}/Hello.java | 2 +- .../listener/ExtenterProjectRunListener.java | 8 ++--- .../listener/ExtenterTestRunListener.java | 8 ++--- .../ExtenterTestSuiteRunListener.java | 14 ++++---- .../listener/Test.java | 2 +- .../reporter/Report.java | 35 ++----------------- .../service/SoapUIService.java | 2 +- .../service/SoapUIServiceImpl.java | 4 +-- 11 files changed, 27 insertions(+), 58 deletions(-) rename src/com/{soapuiutils/dataprovider/soapui/utils => soapuiextentter/dataproviderUtils}/CSVReader.java (96%) rename src/com/{soapuiutils/dataprovider/soapui/utils => soapuiextentter/dataproviderUtils}/ExcelReader.java (98%) rename src/com/{soapuiutils/dataprovider/soapui/utils => soapuiextentter/dataproviderUtils}/Hello.java (77%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/listener/ExtenterProjectRunListener.java (94%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/listener/ExtenterTestRunListener.java (94%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/listener/ExtenterTestSuiteRunListener.java (86%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/listener/Test.java (91%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/reporter/Report.java (98%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/service/SoapUIService.java (95%) rename src/com/{soapuiutils/extentter/soapui => soapuiextentter}/service/SoapUIServiceImpl.java (96%) diff --git a/Listener-XML/soapuiextentter-listeners.xml b/Listener-XML/soapuiextentter-listeners.xml index 6869431..ef23f25 100644 --- a/Listener-XML/soapuiextentter-listeners.xml +++ b/Listener-XML/soapuiextentter-listeners.xml @@ -1,12 +1,12 @@ - - - \ No newline at end of file diff --git a/src/com/soapuiutils/dataprovider/soapui/utils/CSVReader.java b/src/com/soapuiextentter/dataproviderUtils/CSVReader.java similarity index 96% rename from src/com/soapuiutils/dataprovider/soapui/utils/CSVReader.java rename to src/com/soapuiextentter/dataproviderUtils/CSVReader.java index ffa8c14..c8851fd 100644 --- a/src/com/soapuiutils/dataprovider/soapui/utils/CSVReader.java +++ b/src/com/soapuiextentter/dataproviderUtils/CSVReader.java @@ -1,4 +1,4 @@ -package com.soapuiutils.dataprovider.soapui.utils; +package com.soapuiextentter.dataproviderUtils; import java.io.BufferedReader; import java.io.FileReader; diff --git a/src/com/soapuiutils/dataprovider/soapui/utils/ExcelReader.java b/src/com/soapuiextentter/dataproviderUtils/ExcelReader.java similarity index 98% rename from src/com/soapuiutils/dataprovider/soapui/utils/ExcelReader.java rename to src/com/soapuiextentter/dataproviderUtils/ExcelReader.java index d9b1cfc..d93fd36 100644 --- a/src/com/soapuiutils/dataprovider/soapui/utils/ExcelReader.java +++ b/src/com/soapuiextentter/dataproviderUtils/ExcelReader.java @@ -1,4 +1,4 @@ -package com.soapuiutils.dataprovider.soapui.utils; +package com.soapuiextentter.dataproviderUtils; import java.io.File; import java.io.FileInputStream; diff --git a/src/com/soapuiutils/dataprovider/soapui/utils/Hello.java b/src/com/soapuiextentter/dataproviderUtils/Hello.java similarity index 77% rename from src/com/soapuiutils/dataprovider/soapui/utils/Hello.java rename to src/com/soapuiextentter/dataproviderUtils/Hello.java index 6f4e382..28f90f2 100644 --- a/src/com/soapuiutils/dataprovider/soapui/utils/Hello.java +++ b/src/com/soapuiextentter/dataproviderUtils/Hello.java @@ -1,4 +1,4 @@ -package com.soapuiutils.dataprovider.soapui.utils; +package com.soapuiextentter.dataproviderUtils; public class Hello { diff --git a/src/com/soapuiutils/extentter/soapui/listener/ExtenterProjectRunListener.java b/src/com/soapuiextentter/listener/ExtenterProjectRunListener.java similarity index 94% rename from src/com/soapuiutils/extentter/soapui/listener/ExtenterProjectRunListener.java rename to src/com/soapuiextentter/listener/ExtenterProjectRunListener.java index 8627dd9..3e6c3b0 100644 --- a/src/com/soapuiutils/extentter/soapui/listener/ExtenterProjectRunListener.java +++ b/src/com/soapuiextentter/listener/ExtenterProjectRunListener.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.listener; +package com.soapuiextentter.listener; import java.io.File; import java.net.InetAddress; @@ -12,8 +12,8 @@ import com.eviware.soapui.model.testsuite.TestProperty; import com.eviware.soapui.model.testsuite.TestSuite; import com.eviware.soapui.model.testsuite.TestSuiteRunner; -import com.soapuiutils.extentter.soapui.service.SoapUIService; -import com.soapuiutils.extentter.soapui.service.SoapUIServiceImpl; +import com.soapuiextentter.service.SoapUIService; +import com.soapuiextentter.service.SoapUIServiceImpl; /* * Author : Akshay Sharma @@ -34,7 +34,7 @@ public void beforeRun(ProjectRunner runner, ProjectRunContext context) { HashMap klovConfig = getKlovConfiguration(properties); Projservice = new SoapUIServiceImpl(); String projectXmlPath = context.getProject().getPath(); - int index = projectXmlPath.lastIndexOf("\\"); + int index = projectXmlPath.lastIndexOf(File.separator); reportPath = projectXmlPath.substring(0, index); reportPath = reportPath + File.separator + "Reports"; diff --git a/src/com/soapuiutils/extentter/soapui/listener/ExtenterTestRunListener.java b/src/com/soapuiextentter/listener/ExtenterTestRunListener.java similarity index 94% rename from src/com/soapuiutils/extentter/soapui/listener/ExtenterTestRunListener.java rename to src/com/soapuiextentter/listener/ExtenterTestRunListener.java index 95b7c6a..0856d08 100644 --- a/src/com/soapuiutils/extentter/soapui/listener/ExtenterTestRunListener.java +++ b/src/com/soapuiextentter/listener/ExtenterTestRunListener.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.listener; +package com.soapuiextentter.listener; import java.io.File; import java.util.HashMap; @@ -9,8 +9,8 @@ import com.eviware.soapui.model.testsuite.TestRunListener; import com.eviware.soapui.model.testsuite.TestStep; import com.eviware.soapui.model.testsuite.TestStepResult; -import com.soapuiutils.extentter.soapui.service.SoapUIService; -import com.soapuiutils.extentter.soapui.service.SoapUIServiceImpl; +import com.soapuiextentter.service.SoapUIService; +import com.soapuiextentter.service.SoapUIServiceImpl; /* * Author : Akshay Sharma @@ -31,7 +31,7 @@ public void beforeRun(TestCaseRunner runner, TestCaseRunContext context) { TCservice = new SoapUIServiceImpl(); String projectXmlPath = context.getTestCase().getTestSuite().getProject().getPath(); - int index = projectXmlPath.lastIndexOf("\\"); + int index = projectXmlPath.lastIndexOf(File.separator); reportPath = projectXmlPath.substring(0, index); reportPath = reportPath + File.separator + "Reports"; diff --git a/src/com/soapuiutils/extentter/soapui/listener/ExtenterTestSuiteRunListener.java b/src/com/soapuiextentter/listener/ExtenterTestSuiteRunListener.java similarity index 86% rename from src/com/soapuiutils/extentter/soapui/listener/ExtenterTestSuiteRunListener.java rename to src/com/soapuiextentter/listener/ExtenterTestSuiteRunListener.java index 4902ee6..24115d1 100644 --- a/src/com/soapuiutils/extentter/soapui/listener/ExtenterTestSuiteRunListener.java +++ b/src/com/soapuiextentter/listener/ExtenterTestSuiteRunListener.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.listener; +package com.soapuiextentter.listener; import java.io.File; import java.util.HashMap; @@ -9,8 +9,8 @@ import com.eviware.soapui.model.testsuite.TestSuiteRunContext; import com.eviware.soapui.model.testsuite.TestSuiteRunListener; import com.eviware.soapui.model.testsuite.TestSuiteRunner; -import com.soapuiutils.extentter.soapui.service.SoapUIService; -import com.soapuiutils.extentter.soapui.service.SoapUIServiceImpl; +import com.soapuiextentter.service.SoapUIService; +import com.soapuiextentter.service.SoapUIServiceImpl; /* * Author : Akshay Sharma @@ -32,7 +32,7 @@ public void afterRun(TestSuiteRunner runner, TestSuiteRunContext context) { SoapUI.log("Reports are published at " + reportPath); } } catch (Throwable t) { - SoapUI.log("TSYS Extentter Error in beforeTestCase of TestSuiteRunListener " + t.getMessage()); + SoapUI.log("SOAPUI Extentter Error in beforeTestCase of TestSuiteRunListener " + t.getMessage()); } } @@ -43,7 +43,7 @@ public void beforeRun(TestSuiteRunner runner, TestSuiteRunContext context) { TSservice = new SoapUIServiceImpl(); String projectXmlPath = context.getTestSuite().getProject().getPath(); - int index = projectXmlPath.lastIndexOf("\\"); + int index = projectXmlPath.lastIndexOf(File.separator); reportPath = projectXmlPath.substring(0, index); reportPath = reportPath + File.separator + "Reports"; @@ -60,7 +60,7 @@ public void beforeRun(TestSuiteRunner runner, TestSuiteRunContext context) { TSservice.startTestSuiteLogging(testSuiteName, testSuiteDesc, testSuiteId); } } catch (Exception t) { - SoapUI.log("TSYS Extentter plugin cannot be initialized. " + t.getMessage()); + SoapUI.log("SOAPUI Extentter plugin cannot be initialized. " + t.getMessage()); } } @@ -80,7 +80,7 @@ public void beforeTestCase(TestSuiteRunner paramTestSuiteRunner, TestSuiteRunCon TSservice.startTestCaseLogging(testCaseName, testSuiteId, testCaseId); } } catch (Throwable t) { - SoapUI.log("TSYS Extentter Error in beforeTestCase of TestSuiteRunListener " + t.getMessage()); + SoapUI.log("SOAPUI Extentter Error in beforeTestCase of TestSuiteRunListener " + t.getMessage()); } } diff --git a/src/com/soapuiutils/extentter/soapui/listener/Test.java b/src/com/soapuiextentter/listener/Test.java similarity index 91% rename from src/com/soapuiutils/extentter/soapui/listener/Test.java rename to src/com/soapuiextentter/listener/Test.java index fe7a29d..00df961 100644 --- a/src/com/soapuiutils/extentter/soapui/listener/Test.java +++ b/src/com/soapuiextentter/listener/Test.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.listener; +package com.soapuiextentter.listener; import java.io.IOException; import java.net.InetAddress; diff --git a/src/com/soapuiutils/extentter/soapui/reporter/Report.java b/src/com/soapuiextentter/reporter/Report.java similarity index 98% rename from src/com/soapuiutils/extentter/soapui/reporter/Report.java rename to src/com/soapuiextentter/reporter/Report.java index 17527e8..dd23932 100644 --- a/src/com/soapuiutils/extentter/soapui/reporter/Report.java +++ b/src/com/soapuiextentter/reporter/Report.java @@ -1,11 +1,7 @@ -package com.soapuiutils.extentter.soapui.reporter; +package com.soapuiextentter.reporter; import java.io.File; import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -13,7 +9,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.io.FileUtils; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.markuputils.Markup; @@ -212,13 +207,11 @@ public void logPass(TestStepResult testStepContext, String testSuiteId, String t AuthType = testStepContext.getTestStep().getProperty("AuthType"); if (GroovyScript == null) { - actualReq = Request.getValue(); actualRes = Response.getValue(); Markup mReqRes = MarkupHelper.createCodeBlock(actualReq, actualRes); - endPoint = testStepContext.getTestStep().getProperty("Endpoint").getValue(); - + if (AuthType == null) { assignCategory(testSuiteId, "REST"); } else { @@ -226,10 +219,8 @@ public void logPass(TestStepResult testStepContext, String testSuiteId, String t } if (endPoint.contains("#")) { - actualEndPoint = getEndpoint(endPoint); endPointLocation = getEndpointRef(endPoint); - if (actualEndPoint.contains("-")) { String[] Endpoints = actualEndPoint.split("-", 2); String partOne = Endpoints[0].trim(); @@ -250,17 +241,13 @@ public void logPass(TestStepResult testStepContext, String testSuiteId, String t } actualData = "
\n\n ENDPOINT DETAILS : " + actualEndPoint; - getTestNode(testSuiteId, testCaseId).pass(logText + " Check Details " + actualData + "
Below are the Actual Request and Response Data."); - getTestNode(testSuiteId, testCaseId).info(mReqRes); } else { actualData = "
\n\n ENDPOINT DETAILS : " + endPoint; - getTestNode(testSuiteId, testCaseId).pass(logText + " Check Details " + actualData + "
Below are the Actual Request and Response Data."); - getTestNode(testSuiteId, testCaseId).info(mReqRes); } } else { @@ -329,11 +316,9 @@ public void logFail(TestStepResult testStepContext, String testSuiteId, String t AuthType = testStepContext.getTestStep().getProperty("AuthType"); if (GroovyScript == null) { - actualReq = Request.getValue(); actualRes = Response.getValue(); Markup mReqRes = MarkupHelper.createCodeBlock(actualReq, actualRes); - endPoint = testStepContext.getTestStep().getProperty("Endpoint").getValue(); if (AuthType == null) { @@ -343,10 +328,8 @@ public void logFail(TestStepResult testStepContext, String testSuiteId, String t } if (endPoint.contains("#")) { - actualEndPoint = getEndpoint(endPoint); endPointLocation = getEndpointRef(endPoint); - if (actualEndPoint.contains("-")) { String[] Endpoints = actualEndPoint.split("-", 2); String partOne = Endpoints[0].trim(); @@ -367,35 +350,24 @@ public void logFail(TestStepResult testStepContext, String testSuiteId, String t } actualData = "
\n\n ENDPOINT DETAILS : " + actualEndPoint; - getTestNode(testSuiteId, testCaseId).fail(logText + " Failed. Check Details " + actualData + "
Below are the Actual Request and Response Data."); - getTestNode(testSuiteId, testCaseId).info(mReqRes); - getTestNode(testSuiteId, testCaseId).info(new RuntimeException(failedMessages.toString())); - failedMessages.clear(); } else { actualData = "
\n\n ENDPOINT DETAILS : " + endPoint; - getTestNode(testSuiteId, testCaseId).fail(logText + " Failed. Check Details " + actualData + "
Below are the Actual Request and Response Data."); - getTestNode(testSuiteId, testCaseId).info(mReqRes); - getTestNode(testSuiteId, testCaseId).info(new RuntimeException(failedMessages.toString())); - failedMessages.clear(); } } else if (Request == null) { SoapUI.log("Test Log Started for TestStep " + logText + " of TestCase " + testCaseId + " of TestSuite " + testSuiteId); - getTestNode(testSuiteId, testCaseId).fail(logText + " Failed. Check Details "); - getTestNode(testSuiteId, testCaseId).info(new RuntimeException(failedMessages.toString())); - failedMessages.clear(); } else { getTestNode(testSuiteId, testCaseId).fail(logText + " Failed."); @@ -403,11 +375,8 @@ public void logFail(TestStepResult testStepContext, String testSuiteId, String t } else { SoapUI.log("Test Log Started for TestStep " + logText + " of TestCase " + testCaseId + " of TestSuite " + testSuiteId); - getTestNode(testSuiteId, testCaseId).fail(logText + " Failed. Check Details "); - getTestNode(testSuiteId, testCaseId).info(new RuntimeException(failedMessages.toString())); - failedMessages.clear(); } } catch (Exception e) { diff --git a/src/com/soapuiutils/extentter/soapui/service/SoapUIService.java b/src/com/soapuiextentter/service/SoapUIService.java similarity index 95% rename from src/com/soapuiutils/extentter/soapui/service/SoapUIService.java rename to src/com/soapuiextentter/service/SoapUIService.java index 0a9b229..db1ab6e 100644 --- a/src/com/soapuiutils/extentter/soapui/service/SoapUIService.java +++ b/src/com/soapuiextentter/service/SoapUIService.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.service; +package com.soapuiextentter.service; import java.util.HashMap; import java.util.List; diff --git a/src/com/soapuiutils/extentter/soapui/service/SoapUIServiceImpl.java b/src/com/soapuiextentter/service/SoapUIServiceImpl.java similarity index 96% rename from src/com/soapuiutils/extentter/soapui/service/SoapUIServiceImpl.java rename to src/com/soapuiextentter/service/SoapUIServiceImpl.java index 21552dc..f06fce8 100644 --- a/src/com/soapuiutils/extentter/soapui/service/SoapUIServiceImpl.java +++ b/src/com/soapuiextentter/service/SoapUIServiceImpl.java @@ -1,4 +1,4 @@ -package com.soapuiutils.extentter.soapui.service; +package com.soapuiextentter.service; import java.util.HashMap; import java.util.List; @@ -10,8 +10,8 @@ import com.eviware.soapui.model.testsuite.TestStep; import com.eviware.soapui.model.testsuite.TestStepResult; import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus; +import com.soapuiextentter.reporter.Report; import com.eviware.soapui.model.testsuite.TestSuiteRunner; -import com.soapuiutils.extentter.soapui.reporter.Report; /* * Author : Akshay Sharma From ef2e4e19d8610f3ef02c08ad6f334a1c71225cdf Mon Sep 17 00:00:00 2001 From: Akshay Sharma Date: Mon, 16 Oct 2023 20:03:33 +0530 Subject: [PATCH 2/2] Updated Readme file --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f4934a..85c2955 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ## :pushpin: SOAPUI-Extentter (Important) -The pro version for this utility have automatic EMAIL reporting. please email for further details. +The pro version for this utility have some more features like Automatic Email Reporting. please email for further details. [Akshay Sharma](mailto:akshay.sharma979@gmail.com) + +## :pushpin: Not Interested in Reading ? Watch video and setup +[](https://www.youtube.com/watch?v=IAefMoBb0nI "Integrate Extent Report with SOAPUI") + ## :pushpin: SOAPUI-Extentter This is an easy utility create to generate extent report based on SOAPUI project execution. This utility supports SOAPUI PROJECT execution report, SOAPUI TESTSUITE execution report and you can also generate SOAPUI Individual TestCase execution report. @@ -98,10 +102,10 @@ If the value if FALSE, then the project properties are NOT added to Extent Repor As an addOn to this utility, I have also added code for data driven testing support inside SOAPUI. This git repo also have one sample project (calculator-soapui-project_Updated.xml) which have all the groovy code for data driven testing. ## :pushpin: Support: -* This utlity is tested with SOAPUI version 5.3.0, 5.4.0, 5.5.0 & 5.6.0. +* This utlity is tested with SOAPUI version 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0 & 5.7.1 * With version 4.0, this utility is supported and tested with ReadyAPI version 3.9.0, 3.9.1 & 3.9.2 * This utlity is testing on JAVA version "1.8.0_221". -* This utlity is build on top of ExtentReport 5.0.8 +* This utlity is build on top of ExtentReport 5.1.1 * This utility supports Klov Docker release 1.0.1 ## :pushpin: License