public void ThenIVerifyThatTheFieldIsNotPresentInTheStudyXmlFile(string fieldName) { string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); if (!XMLActionUtilities.VerifyXMlContent(File1, fieldName)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify data in the actual and expected XML files.\n Expected and Actual doesnot match"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyTagsStructureInFileAsDisplayedInTheTable_(string FileName, Table table) { IEnumerable <XMLData> Data = table.CreateSet <XMLData>(); List <XMLData> List = (List <XMLData>)Data; if (!XMLActionUtilities.VerifyTagsInXMLFile(FileName, List)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify tags in the XML file. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenICompareAndVerifyTheTagsInSourceXMLFileFromProjectAndTargetXmlFileFromTestFolderAreSame_() { string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); string File2 = ScenarioContext.Current["XMLFileNameInTestFolder"].ToString(); if (!XMLActionUtilities.VerifyTagsInXMLFile(File1, File2)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify tags in the XML file. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyTheBelowInTheStudyXmlFile(Table table) { IEnumerable <XMLNodeData> xmlData = table.CreateSet <XMLNodeData>(); string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); if (!XMLActionUtilities.VerifyXMlContent(File1, (List <XMLNodeData>)xmlData)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify data in the actual and expected XML files.\n Expected and Actual doesnot match"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void GivenIHaveTheXMLFileAvailable_(string FileName) { if (!XMLActionUtilities.VerifyXMLFileInProjectDirectory(FileName)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "The XML file '" + FileName + "' is not available in the project. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } else { ScenarioContext.Current.Add("XMLFileNameInProject", FileName); } }
public void ThenIVerifyBelowDataInTheRespectiveFieldsForTagInTheXMLFile_(string TagName, Table table) { XmlDocument xDoc = (XmlDocument)ScenarioContext.Current["LoadedXML"]; IEnumerable <XMLData> Data = table.CreateSet <XMLData>(); List <XMLData> List = (List <XMLData>)Data; if (!XMLActionUtilities.VerifyFieldDataInXMLTag(xDoc, TagName, List)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify fields in the " + TagName + "' tag in the XML file. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void GivenIHaveOpenedTheXMLFileFromTestXMLFiles_(string XMLFileName) { XmlDocument doc = XMLActionUtilities.LoadAndGetXMLDocFromProject(XMLFileName); if (doc != null) { ScenarioContext.Current.Add("LoadedXML", doc); } else { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "The XML file '" + XMLFileName + "' is not available in the project. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyThatTheDataInBothXMLFilesIsSame_() { List <string> Tags = new List <string>(); List <string> Fields = new List <string>(); string Msg; string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); string File2 = ScenarioContext.Current["XMLFileNameInTestFolder"].ToString(); if (!XMLActionUtilities.CompareDataIn2XMLFiles(File1, File2, Tags, Fields, out Msg)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify data in the actual and expected XML files. \n" + Msg + "\n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyThatTheDataInBothXMLFilesIsSameExceptForBelowTagsAndFields_(Table table) { List <string> Tags = table.Rows.Select(l => l["TagName"]).ToList(); List <string> Fields = table.Rows.Select(l => l["FieldName"]).ToList(); string Msg; Tags.Remove(""); Fields.Remove(""); string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); string File2Folder = FeatureContext.Current["ReportsFolderPath"].ToString(); string File2Name = ScenarioContext.Current["XMLFileNameInTestFolder"].ToString(); string File2 = File2Folder + "\\" + File2Name; if (!XMLActionUtilities.CompareDataIn2XMLFiles(File1, File2, Tags, Fields, out Msg)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify data in the actual and expected XML files. \n" + Msg + "\n"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyThatTheDataInBothMetadataXMLFilesIsSameExceptForBelowTagsAndFields_(Table table) { List <string> Fields = table.Rows.Select(l => l["FieldName"]).ToList(); List <string> Tags = table.Rows.Select(l => l["TagName"]).ToList(); Fields.Remove(""); if (Tags != null && Tags.Count != 0) { Tags.Remove(""); } string File1 = ScenarioContext.Current["XMLFileNameInProject"].ToString(); string File2Folder = FeatureContext.Current["ReportsFolderPath"].ToString(); string File2Name = ScenarioContext.Current["XMLFileNameInTestFolder"].ToString(); string File2 = File2Folder + "\\" + File2Name; if (!XMLActionUtilities.XMLfilesIdentical(File1, File2, Fields, Tags)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Failed to verify data in the actual and expected XML files.\n Expected and Actual doesnot match"; ScenarioContext.Current["ActResult"] = "Failed"; } }
public void ThenIVerifyTheInIsAgainstDBByExecuting(string FieldName, string TagName, string DataValue, string Query) { SQLInfo Info = DataBase.DatabaseSteps.StoreSQLInfo(); try { if (DatabaseUtilities.ConnectToDB(Info)) { Info.QueryResultTable = DatabaseUtilities.GetRecordsFromDB(Query, Info); if (Info.QueryResultTable == null) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Unable to execute query " + Query + " on database. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } else { DataTable data = Info.QueryResultTable; string FilePath = FeatureContext.Current["ReportsFolderPath"].ToString(); string content = data.Rows[0].ItemArray[0].ToString(); XmlDocument xDoc = (XmlDocument)ScenarioContext.Current["LoadedXML"]; if (!XMLActionUtilities.VerifyFieldDataInXMLTag(xDoc, TagName, FieldName, DataValue)) { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + FieldName + " value in " + TagName + " is displayed as " + content + " instead of " + DataValue + ". \n"; ScenarioContext.Current["ActResult"] = "Failed"; } } DatabaseUtilities.CloseDBConnection(Info); } else { ScenarioContext.Current["Comments"] = ScenarioContext.Current["Comments"] + "Unable to connect to database. \n"; ScenarioContext.Current["ActResult"] = "Failed"; } } catch (Exception e) { string abc = Info.DataBaseName; } }
public void GivenIHaveTheXMLFileOpenedAndFindData_() { XMLActionUtilities.VerifyDataInXML("", ""); }