Notes
Notes - notes.io |
String pathToTestData= constants.pathToTestData;
logger.debug("Test Data Location : " + pathToTestData);
List<String[]> resolvedData;
try{
resolvedData = parser.parseAll(new FileReader(pathToTestData));
//Mapping column names to an integer
Map<Integer,String> mapColumnValues = new LinkedHashMap<Integer,String>();
int r=1;
int colSize=0;
for(String[] row:resolvedData){
if(r==1) // To read the column values
{
/******* 01. Mapping column present in test data to an integer******/
logger.debug("n Listed are the columns present in TestData sheet mapped to an integer value");
colSize = row.length;
r++;
int matched=0;
for(int i=0;i<=row.length-1;i++){
//Validating if any of the colum is empty
if(row[i] == null || row[i].isEmpty()){
throw new NotSupportedException("Test Data column cannot be empty.");
}
mapColumnValues.put(i, row[i].toLowerCase()); //instance.put(integer, columnValue)
//Conditional expression to check if mandatory columns are missing
matched = constants.testDataMandatoryColumns.contains(row[i].toLowerCase()) ? matched+1: matched;
}
if(matched!=constants.testDataMandatoryColumns.size()){
//IF size do not match, then exception is throw to add the missing column
throw new NotSupportedException("Mandatory Columns are Missing in test Data");
}
mapColumnValues.forEach((k,v) ->
logger.debug(" key : "+k+" | value:"+ v + "n"));
}else
{
//Mapping column name to corresponding values.
Map<String,String> testDataValues = new LinkedHashMap<String,String>();
for(int i=0;i<=colSize-1;i++){
String columnName = mapColumnValues.get(i); //Fetching column name from mapColumnValues
//System.out.print("ncolumnName : "+columnName);
testDataValues.put(columnName, row[i]); // Column name mapped to associated value
}
logger.info("Listed are the column in Test Data mapped to respective value");
testDataValues.forEach((k,v) ->
logger.info("key: "+ k +" | value: "+ v + "n"));
//To check the status
constants.testCaseController= testDataValues.get("status");
logger.debug("Execution status of " + testDataValues.get("journeyid") + " is :" +constants.testCaseController );
//Validating the status of journeyID
if(constants.testCaseController==null || constants.testCaseController.isEmpty() || "no".equalsIgnoreCase(constants.testCaseController)
|| testDataValues.get("journeyid")==null || testDataValues.get("journeyid").isEmpty()){
continue;
}else{
/******************** TEST CREATION FOR EXTENT REPORT **********/
// Each test will be one JourneyID
constants.extentTest = constants.extentReporter.startTest(testDataValues.get("journeyid") ,testDataValues.get("journeyid"));// we can take two arguements and see what happens
// Statement will throw nullPointerException incase if its invoked any time before startTest
constants.extentTest.assignAuthor(System.getProperty("user.name"));
/*******************CALLING PLATFORM CONTROLLER *********************/
platformController(testDataValues);
/******************* CALLING MAPPING SHEET *********************/
readMappingSheet(testDataValues);
constants.extentReporter.endTest(constants.extentTest);
constants.hasFailure=false;
logger.info("Pointer back to Test Data sheet");
}
//Exit the loop
if(r == 3){
break;
}
}
}
}catch(FileNotFoundException e){
logger.error("Test Data File: Missing");
reusuableFunctions.dispayAlert("TestData Missing in Mentioned Path");
}catch(TextParsingException E)
{
logger.error("File Corruped");
reusuableFunctions.dispayAlert("TestData File Corrupted");
}
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team