Skip to content

Commit

Permalink
Merge pull request #1361 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 6cb7a85 + 356356b commit 1952a0e
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 123 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.CertificateGenerationUtil;
Expand Down Expand Up @@ -51,6 +52,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 Down Expand Up @@ -137,7 +139,6 @@ public static void suiteSetup(String runType) {
if (!runType.equalsIgnoreCase("JAR")) {
AuthTestsUtil.removeOldMosipTempTestResource();
}
BaseTestCase.setReportName("auth");
BaseTestCase.currentModule = "auth";
BaseTestCase.certsForModule = "IDA";
DBManager.executeDBQueries(ConfigManager.getKMDbUrl(), ConfigManager.getKMDbUser(), ConfigManager.getKMDbPass(),
Expand Down Expand Up @@ -174,8 +175,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 @@ -187,14 +186,29 @@ public static void startTestRunner() {
LOGGER.info("ELSE :" + homeDir);
}
for (File file : homeDir.listFiles()) {
TestNG runner = new TestNG();
List<String> suitefiles = new ArrayList<>();

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

BaseTestCase.setReportName("auth");
}
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();

}

public static String getGlobalResourcePath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
import org.testng.SkipException;

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

public class IdAuthenticationUtil extends AdminTestUtil {

private static final Logger logger = Logger.getLogger(IdAuthenticationUtil.class);

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
126 changes: 126 additions & 0 deletions api-test/testNgXmlFiles/authenticationPrerequisiteSuite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Authentication Prerequisite Test 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="ida/AddIdentity/AddIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.AddIdentity" />
</classes>
</test>
<test name="CreateVID">
<parameter name="ymlFile" value="ida/CreateVID/CreateVid.yml" />
<parameter name="idKeyName" value="VID" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>

<test name="UpdateIdentityForUin">
<parameter name="ymlFile"
value="ida/UpdateIdentityForUin/UpdateIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.UpdateIdentity" />
</classes>
</test>


<test name="CreateDraft">
<parameter name="ymlFile" value="ida/CreateDraft/CreateDraft.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PostWithOnlyPathParam" />
</classes>
</test>

<test name="GetDraft">
<parameter name="ymlFile" value="ida/GetDraft/GetDraft.yml" />
<parameter name="idKeyName" value="UIN" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.GetWithParamForAutoGenId" />
</classes>
</test>

<test name="CreateDraftVID">
<parameter name="ymlFile" value="ida/CreateDraftVID/CreateDraftVID.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>


<test name="UpdateDraft">
<parameter name="ymlFile" value="ida/UpdateDraft/UpdateDraft.yml" />
<parameter name="pathParams" value="registrationId" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.UpdateDraft" />
</classes>
</test>

<test name="PublishDraft">
<parameter name="ymlFile" value="ida/PublishDraft/PublishDraft.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.GetWithParam" />
</classes>
</test>
<test name="GenerateVID">
<parameter name="ymlFile"
value="ida/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="DeactivateVIDs">
<parameter name="ymlFile" value="ida/DeactivateUin/DeactivateUin.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>

<test name="RevokeVID">
<parameter name="ymlFile"
value="ida/RevokeVID/createRevokeVID.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PatchWithBodyWithOtpGenerate" />
</classes>
</test>

<test name="AuthInternalLock">
<parameter name="ymlFile"
value="ida/AuthInternalLock/AuthInternalLock.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePost" />
</classes>
</test>

<test name="AuthLock">
<parameter name="ymlFile"
value="ida/AuthLock/createAuthLock.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PostWithBodyWithOtpGenerate" />
</classes>
</test>

</suite>
Original file line number Diff line number Diff line change
Expand Up @@ -8,121 +8,6 @@
<listener class-name="io.mosip.testrig.apirig.report.EmailableReport"/>
</listeners>

<test name="AddIdentity">
<parameter name="ymlFile"
value="ida/AddIdentity/AddIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.AddIdentity" />
</classes>
</test>
<test name="CreateVID">
<parameter name="ymlFile" value="ida/CreateVID/CreateVid.yml" />
<parameter name="idKeyName" value="VID" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>

<test name="UpdateIdentityForUin">
<parameter name="ymlFile"
value="ida/UpdateIdentityForUin/UpdateIdentity.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.UpdateIdentity" />
</classes>
</test>


<test name="CreateDraft">
<parameter name="ymlFile" value="ida/CreateDraft/CreateDraft.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PostWithOnlyPathParam" />
</classes>
</test>

<test name="GetDraft">
<parameter name="ymlFile" value="ida/GetDraft/GetDraft.yml" />
<parameter name="idKeyName" value="UIN" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.GetWithParamForAutoGenId" />
</classes>
</test>

<test name="CreateDraftVID">
<parameter name="ymlFile" value="ida/CreateDraftVID/CreateDraftVID.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>


<test name="UpdateDraft">
<parameter name="ymlFile" value="ida/UpdateDraft/UpdateDraft.yml" />
<parameter name="pathParams" value="registrationId" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.UpdateDraft" />
</classes>
</test>

<test name="PublishDraft">
<parameter name="ymlFile" value="ida/PublishDraft/PublishDraft.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.GetWithParam" />
</classes>
</test>
<test name="GenerateVID">
<parameter name="ymlFile"
value="ida/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="DeactivateVIDs">
<parameter name="ymlFile" value="ida/DeactivateUin/DeactivateUin.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePostForAutoGenId" />
</classes>
</test>

<test name="RevokeVID">
<parameter name="ymlFile"
value="ida/RevokeVID/createRevokeVID.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PatchWithBodyWithOtpGenerate" />
</classes>
</test>

<test name="AuthInternalLock">
<parameter name="ymlFile"
value="ida/AuthInternalLock/AuthInternalLock.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.SimplePost" />
</classes>
</test>

<test name="AuthLock">
<parameter name="ymlFile"
value="ida/AuthLock/createAuthLock.yml" />
<parameter name="prerequisite" value="Yes" />
<classes>
<class name="io.mosip.testrig.apirig.testscripts.PostWithBodyWithOtpGenerate" />
</classes>
</test>

<test name="BioAuth">
<parameter name="ymlFile" value="ida/BioAuth/BioAuth2.yml" />
<parameter name="isInternal" value="false" />
Expand Down

0 comments on commit 1952a0e

Please sign in to comment.