Skip to content

Commit

Permalink
Merge pull request #108 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
MOSIP-36505 | Split the Testng report into pre-requisite and functional test
  • Loading branch information
ckm007 authored Oct 17, 2024
2 parents f151cc8 + 5ce111b commit 0272972
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import io.mosip.testrig.apirig.dataprovider.BiometricDataProvider;
import io.mosip.testrig.apirig.dbaccess.DBManager;
import io.mosip.testrig.apirig.report.EmailableReport;
import io.mosip.testrig.apirig.utils.AdminTestUtil;
import io.mosip.testrig.apirig.utils.AuthTestsUtil;
import io.mosip.testrig.apirig.utils.CertsUtil;
Expand All @@ -49,6 +50,7 @@ public class MosipTestRunner {

public static String jarUrl = MosipTestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath();
public static List<String> languageList = new ArrayList<>();
public static boolean skipAll = false;

/**
* C Main method to start mosip test execution
Expand All @@ -72,6 +74,7 @@ public static void main(String[] arg) {
} else {
ExtractResource.copyCommonResources();
}
AdminTestUtil.init();
InjiCertifyConfigManager.init();
suiteSetup(getRunType());
SkipTestCaseHandler.loadTestcaseToBeSkippedList("testCaseSkippedList.txt");
Expand Down Expand Up @@ -135,7 +138,6 @@ public static void suiteSetup(String runType) {
InjiCertifyConfigManager.getMasterDbUser(), InjiCertifyConfigManager.getMasterDbPass(),
InjiCertifyConfigManager.getMasterDbSchema(),
getGlobalResourcePath() + "/" + "config/masterDataDeleteQueriesForEsignet.txt");
BaseTestCase.setReportName(GlobalConstants.INJICERTIFY);
AdminTestUtil.copymoduleSpecificAndConfigFile(GlobalConstants.INJICERTIFY);
BaseTestCase.otpListener = new OTPListener();
BaseTestCase.otpListener.run();
Expand All @@ -158,8 +160,6 @@ private static void setLogLevels() {
*/
public static void startTestRunner() {
File homeDir = null;
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();
String os = System.getProperty("os.name");
LOGGER.info(os);
if (getRunType().contains("IDE") || os.toLowerCase().contains("windows")) {
Expand All @@ -171,14 +171,26 @@ public static void startTestRunner() {
LOGGER.info("ELSE :" + homeDir);
}
for (File file : homeDir.listFiles()) {
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();
if (file.getName().toLowerCase().contains(GlobalConstants.INJICERTIFY)) {
if (file.getName().toLowerCase().contains("prerequisite")) {
BaseTestCase.setReportName(GlobalConstants.INJICERTIFY + "-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.INJICERTIFY);
}
suitefiles.add(file.getAbsolutePath());
runner.setTestSuites(suitefiles);
System.getProperties().setProperty("testng.outpur.dir", "testng-report");
runner.setOutputDirectory("testng-report");
runner.run();
}
}
runner.setTestSuites(suitefiles);
System.getProperties().setProperty("testng.outpur.dir", "testng-report");
runner.setOutputDirectory("testng-report");
runner.run();

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.nimbusds.jose.jwk.RSAKey;

import io.mosip.testrig.apirig.dto.TestCaseDTO;
import io.mosip.testrig.apirig.testrunner.MosipTestRunner;
import io.mosip.testrig.apirig.testrunner.OTPListener;

public class InjiCertifyUtil extends AdminTestUtil {
Expand Down Expand Up @@ -233,6 +234,10 @@ public static String getKeyWordFromEndPoint(String endPoint) {

public static String isTestCaseValidForExecution(TestCaseDTO testCaseDTO) {
String testCaseName = testCaseDTO.getTestCaseName();

if (MosipTestRunner.skipAll == true) {
throw new SkipException(GlobalConstants.PRE_REQUISITE_FAILED_MESSAGE);
}

if (SkipTestCaseHandler.isTestCaseInSkippedList(testCaseName)) {
throw new SkipException(GlobalConstants.KNOWN_ISSUES);
Expand Down
18 changes: 18 additions & 0 deletions apitest/testNgXmlFiles/injicertifyPrerequisiteSuite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Inji-Certify Prerequisite Suite">
<!-- Passing Group as parmeter unsing "testType" Possible Groups are: smoke
regression smokeAndRegression -->
<listeners>
<listener class-name="io.mosip.testrig.apirig.report.EmailableReport" />
</listeners>

<test name="AddIdentity">
<parameter name="ymlFile" value="injicertify/AddIdentity/AddIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.AddIdentity" />
</classes>
</test>
</suite>
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@
<listener class-name="io.mosip.testrig.apirig.report.EmailableReport" />
</listeners>

<test name="AddIdentity">
<parameter name="ymlFile" value="injicertify/AddIdentity/AddIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.AddIdentity" />
</classes>
</test>
<!--<test name="GenerateVID">
<parameter name="ymlFile" value="injicertify/GenerateVID/createGenerateVID.yml" />
<parameter name="idKeyName" value="vid" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PostWithAutogenIdWithOtpGenerate" />
</classes>
</test>-->
<test name="CreateOIDCClientV2SunBirdC">
<parameter name="ymlFile" value="injicertify/SunBirdC/CreateOIDCClientV2SunBirdC/CreateOIDCClientV2SunBirdC.yml" />
<parameter name="idKeyName" value="clientId" />
Expand Down

0 comments on commit 0272972

Please sign in to comment.