-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #672 from Sohandey/develop
Develop, New Testcases Automated For Prereg
- Loading branch information
Showing
8 changed files
with
372 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,27 +34,28 @@ | |
import io.mosip.testrig.apirig.utils.OutputValidationUtil; | ||
import io.restassured.response.Response; | ||
|
||
public class AuditValidator extends AdminTestUtil implements ITest { | ||
private static final Logger logger = Logger.getLogger(AuditValidator.class); | ||
public class PreregAuditValidator extends AdminTestUtil implements ITest { | ||
private static final Logger logger = Logger.getLogger(PreregAuditValidator.class); | ||
protected String testCaseName = ""; | ||
public static List<String> templateFields = new ArrayList<>(); | ||
public Response response = null; | ||
|
||
/** | ||
* get current testcaseName | ||
*/ | ||
@Override | ||
public String getTestName() { | ||
public String getTestName() { | ||
return testCaseName; | ||
} | ||
|
||
@BeforeClass | ||
public static void setLogLevel() { | ||
if (ConfigManager.IsDebugEnabled()) | ||
logger.setLevel(Level.ALL); | ||
else | ||
logger.setLevel(Level.ERROR); | ||
} | ||
|
||
/** | ||
* Data provider class provides test case list | ||
* | ||
|
@@ -66,52 +67,52 @@ public Object[] getTestCaseList(ITestContext context) { | |
logger.info("Started executing yml: " + ymlFile); | ||
return getYmlTestData(ymlFile); | ||
} | ||
|
||
|
||
|
||
@Test(dataProvider = "testcaselist") | ||
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { | ||
testCaseName = testCaseDTO.getTestCaseName(); | ||
if (HealthChecker.signalTerminateExecution) { | ||
throw new SkipException(GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS); | ||
throw new SkipException( | ||
GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS); | ||
} | ||
String[] templateFields = testCaseDTO.getTemplateFields(); | ||
List<String> queryProp = Arrays.asList(templateFields); | ||
logger.info(queryProp); | ||
String query = "select * from audit.app_audit_log where cr_by = '"+BaseTestCase.currentModule +"-"+propsKernel.getProperty("partner_userName")+"'"; | ||
|
||
|
||
|
||
String query = "select * from audit.app_audit_log where app_name = 'PREREGISTRATION' && session_user_name = '" | ||
+ "[email protected]" + "'"; | ||
|
||
logger.info(query); | ||
Map<String, Object> response = AuditDBManager.executeQueryAndGetRecord(testCaseDTO.getRole(), query); | ||
|
||
|
||
|
||
Map<String, List<OutputValidationDto>> objMap = new HashMap<>(); | ||
List<OutputValidationDto> objList = new ArrayList<>(); | ||
OutputValidationDto objOpDto = new OutputValidationDto(); | ||
if(response.size()>0) { | ||
if (response.size() > 0) { | ||
|
||
objOpDto.setStatus("PASS"); | ||
} | ||
else { | ||
} else { | ||
objOpDto.setStatus(GlobalConstants.FAIL_STRING); | ||
} | ||
|
||
objList.add(objOpDto); | ||
objMap.put(GlobalConstants.EXPECTED_VS_ACTUAL, objList); | ||
|
||
if (!OutputValidationUtil.publishOutputResult(objMap)) | ||
throw new AdminTestException("Failed at output validation"); | ||
} | ||
|
||
|
||
|
||
/** | ||
* The method ser current test name to result | ||
* | ||
* @param result | ||
*/ | ||
@AfterMethod(alwaysRun = true) | ||
public void setResultTestName(ITestResult result) { | ||
|
||
String deleteQuery = "delete from audit.app_audit_log where cr_by = '"+propsKernel.getProperty("partner_userName")+"'"; | ||
|
||
String deleteQuery = "delete from audit.app_audit_log where app_name = 'PREREGISTRATION' and session_user_name = '" | ||
+ "[email protected]" + "'"; | ||
|
||
logger.info(deleteQuery); | ||
AuditDBManager.executeQueryAndDeleteRecord("audit", deleteQuery); | ||
try { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -605,4 +605,44 @@ CreatePrereg: | |
"id": "mosip.pre-registration.demographic.create" | ||
}' | ||
output: '{ | ||
}' | ||
Prereg_CreatePrereg_cancell_incomplete_prid_sid: | ||
endPoint: /preregistration/v1/applications/prereg | ||
role: batch | ||
checkErrorsOnlyInResponse: true | ||
restMethod: post | ||
inputTemplate: preReg/createPrereg/createPrereg | ||
outputTemplate: preReg/createPrereg/createPreregResult | ||
input: '{ | ||
"postalCode": "14022", | ||
"phone": "8249742850", | ||
"email": "[email protected]", | ||
"IDSchemaVersion": $SCHEMAVERSION$, | ||
"dateOfBirth": "1996/01/01", | ||
"version": "1.0", | ||
"langCode": "$1STLANG$", | ||
"requesttime": "$TIMESTAMP$", | ||
"id": "mosip.pre-registration.demographic.create" | ||
}' | ||
output: '{ | ||
}' | ||
Prereg_CreatePrereg_cancell_pending_appoinment_prid_sid: | ||
endPoint: /preregistration/v1/applications/prereg | ||
role: batch | ||
checkErrorsOnlyInResponse: true | ||
restMethod: post | ||
inputTemplate: preReg/createPrereg/createPrereg | ||
outputTemplate: preReg/createPrereg/createPreregResult | ||
input: '{ | ||
"postalCode": "14022", | ||
"phone": "8249742850", | ||
"email": "[email protected]", | ||
"IDSchemaVersion": $SCHEMAVERSION$, | ||
"dateOfBirth": "1996/01/01", | ||
"version": "1.0", | ||
"langCode": "$1STLANG$", | ||
"requesttime": "$TIMESTAMP$", | ||
"id": "mosip.pre-registration.demographic.create" | ||
}' | ||
output: '{ | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.