Skip to content

Commit

Permalink
MOSIP-38489 - Generated single report with 2 sections (#1097)
Browse files Browse the repository at this point in the history
* MOSIP-36485

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-36485

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-36485

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-38489 - Generated single report with 2 sections

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-38489 - Generated single report with 2 sections

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

---------

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
  • Loading branch information
nandhu-kumar authored Jan 16, 2025
1 parent e71d278 commit e550b99
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,34 +199,15 @@ public static void startTestRunner() {
homeDir = new File(dir.getParent() + "/mosip/testNgXmlFiles");
LOGGER.info("ELSE :" + homeDir);
}
// List and sort the files
File[] files = homeDir.listFiles();
if (files != null) {
Arrays.sort(files, (f1, f2) -> {
// Customize the comparison based on file names
if (f1.getName().toLowerCase().contains("prerequisite")) {
return -1; // f1 should come before f2
} else if (f2.getName().toLowerCase().contains("prerequisite")) {
return 1; // f2 comes before f1
}
return f1.getName().compareTo(f2.getName()); // default alphabetical order
});

for (File file : files) {
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();

if (file.getName().toLowerCase().contains(GlobalConstants.ESIGNET)) {
if (file.getName().toLowerCase().contains("prerequisite")) {
BaseTestCase.setReportName(GlobalConstants.ESIGNET + "-prerequisite");
} else {
// if the prerequisite total skipped/failed count is greater than zero
if (EmailableReport.getFailedCount() > 0 || EmailableReport.getSkippedCount() > 0) {
// skipAll = true;
}

BaseTestCase.setReportName(GlobalConstants.ESIGNET);
}
if (file.getName().toLowerCase().contains("mastertestsuite")) {
BaseTestCase.setReportName(GlobalConstants.ESIGNET);
suitefiles.add(file.getAbsolutePath());
runner.setTestSuites(suitefiles);
System.getProperties().setProperty("testng.outpur.dir", "testng-report");
Expand Down
12 changes: 12 additions & 0 deletions api-test/testNgXmlFiles/esignetMasterTestSuite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="eSignet API Test Rig Master Suite">
<listeners>
<listener class-name="io.mosip.testrig.apirig.report.EmailableReport" />
</listeners>
<suite-files>
<suite-file path="esignetPrerequisiteSuite.xml" />
<suite-file path="esignetSuite.xml" />
</suite-files>
</suite>
2 changes: 1 addition & 1 deletion api-test/testNgXmlFiles/esignetPrerequisiteSuite.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="e-Signet Prerequisite Suite">
<suite name="eSignet Pre-requisite API Test">
<!-- Passing Group as parmeter unsing "testType" Possible Groups are: smoke
regression smokeAndRegression -->
<listeners>
Expand Down
2 changes: 1 addition & 1 deletion api-test/testNgXmlFiles/esignetSuite.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="e-Signet Suite">
<suite name="eSignet API Test">
<!-- Passing Group as parmeter unsing "testType" Possible Groups are: smoke
regression smokeAndRegression -->
<listeners>
Expand Down

0 comments on commit e550b99

Please sign in to comment.