public void SimpleScriptFileTestOnLinux() { //Arrange RubyScriptExecuterService rubyScriptExecuterService = new RubyScriptExecuterService(); GingerAction GA = new GingerAction(); List <RubyPrameters> rubyPrameters = new List <RubyPrameters>(); rubyPrameters.Add(new RubyPrameters() { Param = "Param 1", Value = "10" }); rubyPrameters.Add(new RubyPrameters() { Param = "Param 2", Value = "20" }); //Act rubyScriptExecuterService.ExecuteRubyScriptFile(GA, TestResources.GetTestResourcesFile("test.rb"), "=", rubyPrameters); //Assert string str = string.Empty; Assert.AreEqual((GA.Output != null && GA.Output.OutputValues.Count > 0), true, "Execution Output values found validation"); foreach (IGingerActionOutputValue s in GA.Output.OutputValues) { str = s.Value.ToString(); } Assert.AreEqual(str.Contains("30"), true); }
private ApplicationPOMModel CreatePOMOnWizard(string POMName, string POMDescription, string targetApp, Agent agent, string URL, List <eElementType> elementTypeCheckBoxToClickList, List <ElementLocator> prioritizedLocatorsList) { WizardPOM wizard = WizardPOM.CurrentWizard; wizard.NextButton.Click(); ucAgentControl ucAgentControl = (ucAgentControl)wizard.CurrentPage["ucAgentControl AID"].dependencyObject; ucAgentControlPOM ucAgentControlPOM = new ucAgentControlPOM(ucAgentControl); ucAgentControlPOM.SelectValueUCAgentControl(agent); ucAgentControlPOM.UCAgentControlStatusButtonClick(); SleepWithDoEvents(10000); //Process AutoMap Element Locators Grid ucGrid ucElementLocatorsGrid = (ucGrid)wizard.CurrentPage["AutoMapElementLocatorsGrid AID"].dependencyObject; ucGridPOM ucElementLocatorsGridPOM = new ucGridPOM(ucElementLocatorsGrid); int locatorIndex = 0; foreach (ElementLocator elemLocator in prioritizedLocatorsList) { if (!elemLocator.Active) { ucElementLocatorsGridPOM.ClickOnCheckBox(nameof(ElementLocator.Active), nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString()); } ucElementLocatorsGridPOM.ReOrderGridRows(nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString(), locatorIndex); locatorIndex++; } //Process AutoMap Element Types Grid ucGrid ucElementTypesGrid = (ucGrid)wizard.CurrentPage["AutoMapElementTypesGrid AID"].dependencyObject; ucGridPOM ucElementTypesGridPOM = new ucGridPOM(ucElementTypesGrid); foreach (eElementType elementType in elementTypeCheckBoxToClickList) { ucElementTypesGridPOM.ClickOnCheckBox(nameof(UIElementFilter.Selected), nameof(UIElementFilter.ElementType), elementType.ToString()); } string html = TestResources.GetTestResourcesFile(URL); agent.Driver.RunAction(new ActBrowserElement() { ControlAction = ActBrowserElement.eControlAction.GotoURL, ValueForDriver = html }); SleepWithDoEvents(2000); wizard.NextButton.Click(); while (agent.Driver.IsDriverBusy) { SleepWithDoEvents(20000); } wizard.NextButton.Click(); SleepWithDoEvents(2000); wizard.CurrentPage["Name POMID"].SetText(POMName); wizard.CurrentPage["Description POMID"].SetText(POMDescription); wizard.FinishButton.Click(); SleepWithDoEvents(2000); ApplicationPOMModel POM = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>() where x.Name == POMName select x).SingleOrDefault(); return(POM); }
public void TestNGExecutionResultsParsingValidation() { //Arrange GingerAction GA = new GingerAction(); string resultsXmlPath = TestResources.GetTestResourcesFile("testng-results.xml"); //Act TestNGReportXML ngReport = new TestNGReportXML(resultsXmlPath); ngReport.ParseTestNGReport(GA, true); //Assert Assert.AreEqual(string.IsNullOrEmpty(ngReport.LoadError), true, "No report parsing errors validation"); Assert.AreEqual(GA.Errors, @"The Test method 'Dynamic Accessory from Search\getAllCategories' failed with the error: 'Connection reset'", "Error been added correctly to Ginger Action validation"); Assert.AreEqual(General.OutputParamExist(GA, "Total Test Methods", "101"), true, "Output Value- '' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Total Passed Test Methods", "3"), true, "Output Value- 'Total Passed Test Methods' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Total Failed Test Methods", "1"), true, "Output Value- 'Total Failed Test Methods' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Total Skipped Test Methods", "14"), true, "Output Value- 'Total Skipped Test Methods' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Total Ignored Test Methods", "83"), true, "Output Value- 'Total Ignored Test Methods' validation"); Assert.AreEqual(GA.Output.OutputValues.Where(x => x.Param == "Dynamic Accessory from Search- Suite Start Time").First().Value.ToString().Contains("19"), true, string.Format("Output Value- 'Dynamic Accessory from Search- Suite Start Time' validation, value:'{0}'", GA.Output.OutputValues.Where(x => x.Param == "Dynamic Accessory from Search- Suite Start Time").First().Value)); Assert.AreEqual(GA.Output.OutputValues.Where(x => x.Param == "Dynamic Accessory from Search- Suite Finish Time").First().Value.ToString().Contains("40"), true, "Output Value- 'Dynamic Accessory from Search- Suite Finish Time' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Dynamic Accessory from Search- Suite Duration (MS)", "21069"), true, "Output Value- 'Dynamic Accessory from Search- Suite Duration (MS)' validation"); Assert.AreEqual(General.OutputParamExist(GA, "Automation_Setup\\initialAutomationSetup-Test Status", "PASS"), true, "Output Value- PASS test validation"); Assert.AreEqual(General.OutputParamExist(GA, "Dynamic Accessory from Search\\selectProductOfferingDynamic-Test Status", "SKIP"), true, "Output Value- SKIP test validation"); Assert.AreEqual(General.OutputParamExist(GA, "Dynamic Accessory from Search\\selectProductOfferingDynamic-Error Message", "Attribute: categoryIds is not exist in context."), true, "Output Value- Skipped test Error Message validation"); Assert.AreEqual(General.OutputParamExist(GA, "Dynamic Accessory from Search\\getAllCategories-Test Status", "FAIL"), true, "Output Value- FAIL test validation"); Assert.AreEqual(General.OutputParamExist(GA, "Dynamic Accessory from Search\\getAllCategories-Error Message", "Connection reset"), true, "Output Value- Failed test Error Message validation"); }
public void SoapUICreateCopyTest() { //Arrange ActSoapUI actSoapUI = new ActSoapUI(); actSoapUI.Description = "Soap Wrapper acttion test "; var xmlFilePath = TestResources.GetTestResourcesFile(@"XML\calculator_soapui_project.xml"); actSoapUI.AddOrUpdateInputParamValue(ActSoapUI.Fields.ImportFile, xmlFilePath); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.UIrelated, "False"); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.ImportFile, "True"); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.IgnoreValidation, "False"); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.TestCasePropertiesRequiered, "False"); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.AddXMLResponse, "False"); actSoapUI.GetOrCreateInputParam(ActSoapUI.Fields.TestCasePropertiesRequieredControlEnabled, "False"); //Act var duplicateAct = (ActSoapUI)actSoapUI.CreateCopy(true); //Assert Assert.AreEqual(actSoapUI.ActInputValues.Count, duplicateAct.ActInputValues.Count); Assert.AreEqual(actSoapUI.ActInputValues[1].Value.ToString(), duplicateAct.ActInputValues[1].Value.ToString()); }
public void AddAPIFromJSONAndAvoidDuplicateNodesTest() { //Arrange string JsonFilePath = TestResources.GetTestResourcesFile(@"JSON\Request JSON.TXT"); ObservableList <ApplicationAPIModel> AAMTempList = new ObservableList <ApplicationAPIModel>(); List <JsonExtended> jsonElements = new List <JsonExtended>(); List <JsonExtended> jsonElementsAvoidDuplicatesNodes = new List <JsonExtended>(); List <AppModelParameter> AppModelParameters = new List <AppModelParameter>(); List <AppModelParameter> AppModelParametersAvoidDuplicatesNodes = new List <AppModelParameter>(); //Act AAMTempList = new JSONTemplateParser().ParseDocument(JsonFilePath, AAMTempList, false); jsonElements = new JsonExtended(AAMTempList[0].RequestBody).GetAllNodes().Where(x => x.Name == "id").ToList(); AppModelParameters = AAMTempList[0].AppModelParameters.Where(x => x.TagName == "id").ToList(); AAMTempList = new JSONTemplateParser().ParseDocument(JsonFilePath, AAMTempList, true); jsonElementsAvoidDuplicatesNodes = new JsonExtended(AAMTempList[0].RequestBody).GetAllNodes().Where(x => x.Name == "id").ToList(); AppModelParametersAvoidDuplicatesNodes = AAMTempList[0].AppModelParameters.Where(x => x.TagName == "id").ToList(); //Assert Assert.AreEqual(jsonElements.Count, 499); Assert.AreEqual(jsonElementsAvoidDuplicatesNodes.Count, 1); Assert.AreEqual(AppModelParameters.Count, 499); Assert.AreEqual(AppModelParametersAvoidDuplicatesNodes.Count, 1); }
public void JSONTemplateCreateBillingArrangement() { //Arrange JSONTemplateParser jSONTemplateParser = new JSONTemplateParser(); string createBillingArrangementFileName = TestResources.GetTestResourcesFile(@"AutoPilot\JSONTemplates\login.json"); //Act ObservableList <ApplicationAPIModel> createPaymentProfileModels = new ObservableList <ApplicationAPIModel>(); jSONTemplateParser.ParseDocument(createBillingArrangementFileName, createPaymentProfileModels); TemplateFile TempleteFile = new TemplateFile() { FilePath = createBillingArrangementFileName }; createPaymentProfileModels[0].OptionalValuesTemplates.Add(TempleteFile); Dictionary <Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >(); ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters(); ImportOptionalValues.ShowMessage = false; ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(createPaymentProfileModels[0], OptionalValuesPerParameterDict); ImportOptionalValues.PopulateOptionalValuesForAPIParameters(createPaymentProfileModels[0], OptionalValuesPerParameterDict); //Assert Assert.AreEqual(createPaymentProfileModels.Count, 1, "APIModels count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters.Count, 2, "AppModelParameters count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].PlaceHolder, "<USER>", "PlaceHolder name check"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[1].PlaceHolder, "<PASSWORD>", "PlaceHolder name check"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList.Count, 1, "AppModelParameters count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList[0].Value, "restOwner", "OptionalValue check"); }
public void TwoWebElementsDistances() { //Arrange ActBrowserElement actBrowser = new ActBrowserElement(); actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL; actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString()); actBrowser.GetOrCreateInputParam("Value", TestResources.GetTestResourcesFile("TestForm.htm")); actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString()); ActPWL actPWL = new ActPWL(); actPWL.LocateBy = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID; actPWL.LocateValue = "Btn_Click"; actPWL.PWLAction = GingerCore.Actions.ActPWL.ePWLAction.GetHDistanceRight2Left; actPWL.OLocateBy = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID; actPWL.OLocateValue = "ddLst"; ActGenElement actGenElement = new ActGenElement(); actGenElement.GenElementAction = GingerCore.Actions.ActGenElement.eGenElementAction.RunJavaScript; actGenElement.GetOrCreateInputParam("Value", "document.getElementById('Btn_Click').getBoundingClientRect().top"); actGenElement.AddNewReturnParams = true; //Act mGR.RunAction(actBrowser, false); mGR.RunAction(actPWL, false); mGR.RunAction(actGenElement, false); //Assert Assert.AreEqual(eRunStatus.Passed, actGenElement.Status, "Action Status"); Assert.AreEqual("8", actGenElement.ReturnValues[0].Actual); }
public static void MyClassInitialize(TestContext testContext) { jsonFileName = TestResources.GetTestResourcesFile(@"JSON\sample2.json"); xmlFileName = TestResources.GetTestResourcesFile(@"XML\book.xml"); xmlWithPrefixFileName = TestResources.GetTestResourcesFile(@"XML\book_with_prefix.xml"); DynamicElements = new ObservableList <ActInputValue>(); }
public void XMLTemplateParesrCreatePaymentProfile() { //Arrange XMLTemplateParser xMLTemplateParser = new XMLTemplateParser(); string createPaymentProfileFileName = TestResources.GetTestResourcesFile(@"AutoPilot\XMLTemplates\bankCode.xml"); //Act ObservableList <ApplicationAPIModel> createPaymentProfileModels = new ObservableList <ApplicationAPIModel>(); xMLTemplateParser.ParseDocument(createPaymentProfileFileName, createPaymentProfileModels); TemplateFile TempleteFile = new TemplateFile() { FilePath = createPaymentProfileFileName }; createPaymentProfileModels[0].OptionalValuesTemplates.Add(TempleteFile); Dictionary <Tuple <string, string>, List <string> > OptionalValuesPerParameterDict = new Dictionary <Tuple <string, string>, List <string> >(); ImportOptionalValuesForParameters ImportOptionalValues = new ImportOptionalValuesForParameters(); ImportOptionalValues.ShowMessage = false; ImportOptionalValues.GetAllOptionalValuesFromExamplesFiles(createPaymentProfileModels[0], OptionalValuesPerParameterDict); ImportOptionalValues.PopulateOptionalValuesForAPIParameters(createPaymentProfileModels[0], OptionalValuesPerParameterDict); //Assert Assert.AreEqual(createPaymentProfileModels.Count, 1, "APIModels count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters.Count, 1, "AppModelParameters count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].PlaceHolder, "{BLZ}", "PlaceHolder name check"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList.Count, 1, "AppModelParameters count"); Assert.AreEqual(createPaymentProfileModels[0].AppModelParameters[0].OptionalValuesList[0].Value, "46451012", "OptionalValue check"); }
public void SmartSyncAction() { //Arrange ActBrowserElement actBrowser = new ActBrowserElement(); actBrowser.ControlAction = ActBrowserElement.eControlAction.GotoURL; actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.URLSrc, ActBrowserElement.eURLSrc.Static.ToString()); actBrowser.GetOrCreateInputParam("Value", TestResources.GetTestResourcesFile("TestForm.htm")); actBrowser.AddOrUpdateInputParamValue(ActBrowserElement.Fields.GotoURLType, ActBrowserElement.eGotoURLType.Current.ToString()); ActUIElement actUIElement = new ActUIElement(); actUIElement.ElementLocateBy = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID; actUIElement.ElementLocateValue = "hyperLinkHover"; actUIElement.ElementType = Amdocs.Ginger.Common.UIElement.eElementType.HyperLink; actUIElement.ElementAction = GingerCore.Actions.Common.ActUIElement.eElementAction.Click; ActSmartSync actSmartSync = new ActSmartSync(); actSmartSync.LocateBy = Amdocs.Ginger.Common.UIElement.eLocateBy.ByID; actSmartSync.LocateValue = "txtBox_Google"; actSmartSync.SmartSyncAction = GingerCore.Actions.ActSmartSync.eSmartSyncAction.WaitUntilDisapear; //Act mGR.RunAction(actBrowser, false); mGR.RunAction(actUIElement, false); mGR.RunAction(actSmartSync, false); //Assert Assert.AreEqual(eRunStatus.Passed, actSmartSync.Status, "Action Status"); }
public void WriteExcelMultiRowsWithFilterTest() { //Arrange ActExcel actExcel = new ActExcel(); actExcel.RunOnBusinessFlow = new GingerCore.BusinessFlow(); actExcel.AddOrUpdateInputParamValueAndCalculatedValue(nameof(ActExcel.ExcelFileName), TestResources.GetTestResourcesFile(excelPathWriteTemp)); actExcel.AddOrUpdateInputParamValueAndCalculatedValue(nameof(ActExcel.SheetName), "Sheet1"); actExcel.AddOrUpdateInputParamValueAndCalculatedValue(nameof(ActExcel.SelectRowsWhere), "Last='Cohen'"); actExcel.AddOrUpdateInputParamValueAndCalculatedValue(nameof(ActExcel.ColMappingRules), "First='Simon'"); actExcel.ExcelActionType = ActExcel.eExcelActionType.WriteData; actExcel.SelectAllRows = true; //Act actExcel.Execute(); //Assert IExcelOperations excelOperations = new ExcelNPOIOperations(); DataTable dt = excelOperations.ReadData(excelPathWriteTemp, actExcel.SheetName, actExcel.SelectRowsWhere, actExcel.SelectAllRows); string actual = ""; foreach (DataRow dr in dt.Rows) { string current = string.Join(',', dr.ItemArray.Select(x => x).ToList()); actual = string.Join(',', actual, current); } Assert.AreEqual(actual.TrimStart(','), "1,Simon,Cohen,2109 Fox Dr,4,Simon,Cohen,NY"); }
//We do visual compare using ImageMagick public bool IsVisualEquel(Visual visual, string VisualID) { string tempScreenFolder = TestResources.GetTestTempFolder("VisualCompareScreens"); if (!System.IO.Directory.Exists(tempScreenFolder)) { System.IO.Directory.CreateDirectory(tempScreenFolder); } string FileName = Path.Combine(tempScreenFolder, VisualID + ".png"); if (File.Exists(FileName)) { File.Delete(FileName); } TakeVisualScreenShot(visual, FileName); string BaselineFileName = TestResources.GetTestResourcesFile(@"VisualCompareScreens\" + VisualID + ".png"); string ResultFileName = Path.Combine(tempScreenFolder, VisualID + "_Diff.png"); if (File.Exists(ResultFileName)) { File.Delete(ResultFileName); } // Copy also baseline to output temp folder if (System.IO.File.Exists(BaselineFileName)) { string baseLinefileName = Path.Combine(tempScreenFolder, VisualID + ".Baseline.png"); File.Copy(BaselineFileName, baseLinefileName, true); bool Diff = IsBitmapEquel(BaselineFileName, FileName, ResultFileName); return(Diff); } else { throw new Exception("No baseline file for compare, missing: " + BaselineFileName); } }
public void GetBusinessFlowDependacies() { //Arrange string filePath = TestResources.GetTestResourcesFile(@"Solutions" + Path.DirectorySeparatorChar + "GlobalCrossSolution" + Path.DirectorySeparatorChar + "BusinessFlows" + Path.DirectorySeparatorChar + "Flow 1.Ginger.BusinessFlow.xml"); //Act GlobalSolutionItem item = new GlobalSolutionItem(GlobalSolution.eImportItemType.Environments, filePath, GlobalSolutionUtils.Instance.ConvertToRelativePath(filePath), true, GlobalSolutionUtils.Instance.GetRepositoryItemName(filePath), ""); GlobalSolutionUtils.Instance.AddDependaciesForBusinessFlows(item, ref SelectedItemsListToImport, ref VariableListToImport, ref EnvAppListToImport); //Assert Assert.AreEqual(SelectedItemsListToImport.Count, 12); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\Applications Models\\POM Models\\SeleniumDemoValid.Ginger.ApplicationPOMModel.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\SharedRepository\\Actions\\Browser Action.Ginger.Action.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\SharedRepository\\Actions\\UIElement Action.Ginger.Action.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\SharedRepository\\Activities\\Activity 2.Ginger.Activity.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\DataSources\\AccessDS.Ginger.DataSource.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\Documents\\bankCode3.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\Documents\\Multiple Values.xlsx")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\Environments\\Test.Ginger.Environment.xml")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "NewVarString")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "MyWebApp")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "MyWebServicesApp")); Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "MyWindowsApp")); Assert.AreEqual(VariableListToImport.Count, 2); Assert.IsNotNull(VariableListToImport.Where(x => x.Name == "NewVarString")); Assert.IsNotNull(VariableListToImport.Where(x => x.Name == "NewVarPasswordString")); string strValuetoPass = EncryptionHandler.DecryptwithKey(VariableListToImport.Where(x => x.Name == "NewVarPasswordString").FirstOrDefault().Value, EncryptionHandler.GetDefaultKey()); Assert.AreEqual(strValuetoPass, "ABCD"); Assert.AreEqual(EnvAppListToImport.Count, 1); Assert.IsNotNull(EnvAppListToImport.Where(x => x.Name == "MyWebApp")); }
public void MissingVariableUsedOnlyInSetVariableActionTest() { //Arrange NewRepositorySerializer RepositorySerializer = new NewRepositorySerializer(); string FileName = TestResources.GetTestResourcesFile(@"Solutions" + Path.DirectorySeparatorChar + "AnalyzerTestSolution" + Path.DirectorySeparatorChar + "BusinessFlows" + Path.DirectorySeparatorChar + "MissingVariableUsedOnlyInSetVariable.Ginger.BusinessFlow.xml"); //Load BF BusinessFlow businessFlow = (BusinessFlow)RepositorySerializer.DeserializeFromFile(FileName); ObservableList <AnalyzerItemBase> mIssues = new ObservableList <AnalyzerItemBase>(); AnalyzerUtils mAnalyzerUtils = new AnalyzerUtils(); WorkSpace.Instance.SolutionRepository = SR; businessFlow.Variables.Remove(businessFlow.GetVariable("username")); //Run Analyzer mAnalyzerUtils.RunBusinessFlowAnalyzer(businessFlow, mIssues); //Asert Assert.AreEqual(1, mIssues.Count); Assert.AreEqual(AnalyzerItemBase.eSeverity.High, mIssues[0].Severity); Assert.AreEqual("The Variable 'username' is missing", mIssues[0].Description); Assert.AreEqual(AnalyzerItemBase.eType.Error, mIssues[0].IssueType); Assert.AreEqual(AnalyzerItemBase.eCanFix.Yes, mIssues[0].CanAutoFix, "Auto Fix validation when missing variable is used only in Set variable action"); }
public IEBrowserWindow() { InitializeComponent(); FillScriptsCombo(); URLTextBox.Text = TestResources.GetTestResourcesFile(@"HTML\HTMLControls.html"); }
public void GotoHTMLControls() { string HTMLControlFile = "file://" + TestResources.GetTestResourcesFile("HTMLControls.html"); GingerAction GA1 = new GingerAction(); mSeleniumDriver.Navigate(GA1, HTMLControlFile); }
public void ActXMLProcessingTest() { //Arrange ActXMLProcessing action = new ActXMLProcessing(); var templateFile = TestResources.GetTestResourcesFile(@"XML\TemplateVU.xml"); action.GetOrCreateInputParam(ActXMLProcessing.Fields.TemplateFileName, templateFile); action.TemplateFileName.ValueForDriver = templateFile; var targetFile = TestResources.GetTestResourcesFile(@"XML\TargetFile.xml"); action.GetOrCreateInputParam(ActXMLProcessing.Fields.TargetFileName, targetFile); action.TargetFileName.ValueForDriver = targetFile; VariableString stringVar = new VariableString(); stringVar.Name = "env"; stringVar.Value = "xyz"; mBF.CurrentActivity.AddVariable(stringVar); ObservableList <ActInputValue> paramList = new ObservableList <ActInputValue>(); paramList.Add(new ActInputValue() { Param = "PAR_ENV", Value = "{Var Name=env}" }); paramList.Add(new ActInputValue() { Param = "PAR_USER", Value = "abc" }); paramList.Add(new ActInputValue() { Param = "PAR_PASS", Value = "abc123" }); paramList.Add(new ActInputValue() { Param = "PAR_BUCKET", Value = "pqrst" }); paramList.Add(new ActInputValue() { Param = "PAR_QUERY", Value = "test1234" }); action.DynamicElements = paramList; action.Active = true; action.AddNewReturnParams = true; mBF.CurrentActivity.Acts.Add(action); mBF.CurrentActivity.Acts.CurrentItem = action; //Act mGR.RunAction(action, false); //Assert Assert.AreEqual(eRunStatus.Passed, action.Status, "Action Status"); Assert.AreEqual(7, action.ReturnValues.Count); Assert.AreEqual("xyz", action.ReturnValues[0].Actual); Assert.AreEqual(action.Error, null, "Act.Error"); }
public void AddAPIFromXMLAndAvoidDuplicateNodesTest() { //Arrange string XmlfFilePath = TestResources.GetTestResourcesFile(@"XML\createPaymentRequest2.xml"); ObservableList <ApplicationAPIModel> AAMTempList = new ObservableList <ApplicationAPIModel>(); XmlDocument doc = new XmlDocument(); List <XMLDocExtended> xmlElements = new List <XMLDocExtended>(); List <XMLDocExtended> xmlElementsAvoidDuplicatesNodes = new List <XMLDocExtended>(); List <AppModelParameter> AppModelParameters = new List <AppModelParameter>(); List <AppModelParameter> AppModelParametersAvoidNodes = new List <AppModelParameter>(); //Act AAMTempList = new XMLTemplateParser().ParseDocument(XmlfFilePath, AAMTempList, false); doc.LoadXml(AAMTempList[0].RequestBody); xmlElements = new XMLDocExtended(doc).GetAllNodes().Where(x => x.Name == "tag").ToList(); AppModelParameters = AAMTempList[0].AppModelParameters.Where(x => x.TagName == "tag").ToList(); AAMTempList = new XMLTemplateParser().ParseDocument(XmlfFilePath, AAMTempList, true); doc.LoadXml(AAMTempList[0].RequestBody); xmlElementsAvoidDuplicatesNodes = new XMLDocExtended(doc).GetAllNodes().Where(x => x.Name == "tag").ToList(); AppModelParametersAvoidNodes = AAMTempList[0].AppModelParameters.Where(x => x.TagName == "tag").ToList(); //Assert Assert.AreEqual(xmlElements.Count, 4); Assert.AreEqual(xmlElementsAvoidDuplicatesNodes.Count, 1); Assert.AreEqual(AppModelParameters.Count, 4); Assert.AreEqual(AppModelParametersAvoidNodes.Count, 1); }
public void APILearnSwaggerMetroTest() { //Arrange SwaggerParser wsdlParser = new SwaggerParser(); ObservableList <ApplicationAPIModel> AAMSList = new ObservableList <ApplicationAPIModel>(); //Act string path = TestResources.GetTestResourcesFile(@"AutoPilot\Swagger\swagger.json"); wsdlParser.ParseDocument(path, AAMSList); //Assert Assert.AreEqual(AAMSList.Count, 22, "Is API's equal to 6"); Assert.AreEqual(AAMSList[0].EndpointURL, "https://petstore.swagger.io/v2/pet", "Is EndpointURL equal"); Assert.AreEqual(String.IsNullOrEmpty(AAMSList[0].RequestBody), false, "Is body not empty equal"); Assert.AreEqual(AAMSList[0].AppModelParameters.Count, 8, "are parameters are equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[0].PlaceHolder, "<ID>", "are parameters are equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[1].PlaceHolder, "<ID1>", "are parameters are equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[2].PlaceHolder, "<NAME>", "are parameters are equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[3].PlaceHolder, "<NAME1>", "are parameters are equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[4].PlaceHolder, "<PHOTOURLS[0]>", "Is parameter name equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[5].PlaceHolder, "<ID2>", "Is parameter name equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[6].PlaceHolder, "<NAME2>", "Is parameter name equal"); Assert.AreEqual(AAMSList[0].AppModelParameters[7].PlaceHolder, "<STATUS>", "Is parameter name equal"); }
public void LegacyWebServiceToNewWebApiSoap_Converter_Test() { Activity oldActivity = new Activity(); oldActivity.Active = true; oldActivity.ActivityName = "Legacy Web Service activity"; oldActivity.CurrentAgent = wsAgent; mBF.Activities.Add(oldActivity); ActWebService actLegacyWebService = new ActWebService(); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.URL, @"http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.SOAPAction, @""); var xmlFileNamePath = TestResources.GetTestResourcesFile(@"XML\stock.xml"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.XMLfileName, xmlFileNamePath); actLegacyWebService.FileName = "Web Service Action"; actLegacyWebService.FilePath = "Web Service Action"; actLegacyWebService.Active = true; actLegacyWebService.AddNewReturnParams = true; mBF.Activities[0].Acts.Add(actLegacyWebService); mDriver.StartDriver(); mGR.RunRunner(); Assert.AreNotEqual(0, actLegacyWebService.ReturnValues.Count); Assert.AreEqual("ten thousand", actLegacyWebService.ReturnValues.FirstOrDefault(x => x.Param == @"m:NumberToWordsResult").Actual); //Convert the legacy action Activity newActivity = new Activity() { Active = true }; newActivity.ActivityName = "New - " + oldActivity.ActivityName; newActivity.CurrentAgent = wsAgent; mBF.Activities.Add(newActivity); Act newAction = ((IObsoleteAction)actLegacyWebService).GetNewAction(); newAction.AddNewReturnParams = true; newAction.Active = true; newAction.ItemName = "Converted webapisoap action"; newActivity.Acts.Add((ActWebAPISoap)newAction); mBF.Activities[1].Acts.Add(newAction); //Assert converted action Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual("ten thousand", newAction.ReturnValues.FirstOrDefault(x => x.Param == @"m:NumberToWordsResult").Actual); //Run newAction mGR.RunRunner(); //assert newaction Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual("ten thousand", newAction.ReturnValues.FirstOrDefault(x => x.Param == @"m:NumberToWordsResult").Actual); }
public static void ClassInitialize(TestContext TC) { Reporter.ToLog(eLogLevel.DEBUG, "Creating the GingerCoreNET WorkSpace"); WorkSpaceEventHandler WSEH = new WorkSpaceEventHandler(); WorkSpace.Init(WSEH); string TempSolutionFolder = TestResources.GetTestTempFolder(@"Solutions" + Path.DirectorySeparatorChar + "APIModelsComparisonUtilityTest"); if (Directory.Exists(TempSolutionFolder)) { Directory.Delete(TempSolutionFolder, true); } WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository(); WorkSpace.Instance.SolutionRepository.CreateRepository(TempSolutionFolder); NewRepositorySerializer RS = new NewRepositorySerializer(); NewRepositorySerializer.AddClassesFromAssembly(typeof(ApplicationAPIModel).Assembly); WorkSpace.Instance.SolutionRepository.Open(TempSolutionFolder); // Initialize ApplicationAPIModels XML file names to be fetched from TestResources xmlFiles = new List <string>() { @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "Create_User.Ginger.ApplicationAPIModel.xml", @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "Delete_User.Ginger.ApplicationAPIModel.xml", @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "PhoneVerifySOAP_CheckPhoneNumber.Ginger.ApplicationAPIModel.xml", @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "Update_User.Ginger.ApplicationAPIModel.xml", @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "PhoneVerifySOAP_CheckPhoneNumbers.Ginger.ApplicationAPIModel.xml", @"Repository" + Path.DirectorySeparatorChar + "SampleAPIModels" + Path.DirectorySeparatorChar + "GetQuote_DelayedStockQuoteSoap.Ginger.ApplicationAPIModel.xml", }; existingAPIsList = new ObservableList <ApplicationAPIModel>(); learnedAPIsList = new List <ApplicationAPIModel>(); // Importing API Models from XML files (listed in xmlFiles) foreach (String fileName in xmlFiles) { var tempFile = TestResources.GetTestResourcesFile(fileName); ApplicationAPIModel appModel = RS.DeserializeFromFile(typeof(ApplicationAPIModel), tempFile) as ApplicationAPIModel; appModel.FilePath = appModel.Name;//so it will get new file path when been added to repository later if (appModel != null) { existingAPIsList.Add(appModel); learnedAPIsList.Add(appModel.CreateCopy() as ApplicationAPIModel); } } // Modifying certain API Models for testing different Comparison status and scenarios existingAPIsList[1].RequestBody = existingAPIsList[1].RequestBody + "This is modified"; existingAPIsList[3].RequestBody = existingAPIsList[3].RequestBody + "This is also modified"; // Storing the API Models in the Solution Repository as will be utilized during Comparison process foreach (ApplicationAPIModel apiModel in existingAPIsList.Skip(1).Take(4)) { WorkSpace.Instance.SolutionRepository.AddRepositoryItem(apiModel); } }
public void LegacyWebServiceToNewWebApiSoap_Converter_Test() { Activity oldActivity = new Activity(); oldActivity.Active = true; oldActivity.ActivityName = "Legacy Web Service activity"; oldActivity.CurrentAgent = wsAgent; mBF.Activities.Add(oldActivity); ActWebService actLegacyWebService = new ActWebService(); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.URL, @"http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.SOAPAction, @"http://ws.cdyne.com/GetQuickQuote"); var xmlFileNamePath = TestResources.GetTestResourcesFile(@"XML\stock.xml"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.XMLfileName, xmlFileNamePath); actLegacyWebService.FileName = "Web Service Action"; actLegacyWebService.FilePath = "Web Service Action"; actLegacyWebService.Active = true; actLegacyWebService.AddNewReturnParams = true; mBF.Activities[0].Acts.Add(actLegacyWebService); mDriver.StartDriver(); mGR.RunRunner(); Assert.AreNotEqual(0, actLegacyWebService.ReturnValues.Count); Assert.AreEqual(0, Convert.ToInt32(actLegacyWebService.ReturnValues.FirstOrDefault(x => x.Param == @"GetQuickQuoteResult").Actual)); //Convert the legacy action Activity newActivity = new Activity() { Active = true }; newActivity.ActivityName = "New - " + oldActivity.ActivityName; newActivity.CurrentAgent = wsAgent; mBF.Activities.Add(newActivity); Act newAction = ((IObsoleteAction)actLegacyWebService).GetNewAction(); newAction.AddNewReturnParams = true; newAction.Active = true; newAction.ItemName = "Converted webapisoap action"; newActivity.Acts.Add((ActWebAPISoap)newAction); mBF.Activities[1].Acts.Add(newAction); //Assert converted action Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual(0, Convert.ToInt32(newAction.ReturnValues.FirstOrDefault(x => x.Param == @"GetQuickQuoteResult").Actual)); //Run newAction mGR.RunRunner(); //assert newaction Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual(0, Convert.ToInt32(newAction.ReturnValues.FirstOrDefault(x => x.Param == @"GetQuickQuoteResult").Actual)); }
public void LegacyWebServiceToNewWebApiSoap_Converter_Test() { Activity oldActivity = new Activity(); oldActivity.Active = true; oldActivity.ActivityName = "Legacy Web Service activity"; oldActivity.CurrentAgent = wsAgent; mBF.Activities.Add(oldActivity); ActWebService actLegacyWebService = new ActWebService(); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.URL, @"http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.SOAPAction, @""); var xmlFileNamePath = TestResources.GetTestResourcesFile(@"XML" + Path.DirectorySeparatorChar + "stock.xml"); actLegacyWebService.AddOrUpdateInputParamValue(ActWebService.Fields.XMLfileName, xmlFileNamePath); actLegacyWebService.FileName = "Web Service Action"; actLegacyWebService.FilePath = "Web Service Action"; actLegacyWebService.Active = true; actLegacyWebService.AddNewReturnParams = true; mBF.Activities[0].Acts.Add(actLegacyWebService); mDriver.StartDriver(); mGR.Executor.RunRunner(); Assert.AreNotEqual(0, actLegacyWebService.ReturnValues.Count); Assert.AreEqual("Åland Islands", actLegacyWebService.ReturnValues.FirstOrDefault(x => x.Param == @"m:sName").Actual); //Convert the legacy action Activity newActivity = new Activity() { Active = true }; newActivity.ActivityName = "New - " + oldActivity.ActivityName; newActivity.CurrentAgent = wsAgent; mBF.Activities.Add(newActivity); Act newAction = ((IObsoleteAction)actLegacyWebService).GetNewAction(); newAction.AddNewReturnParams = true; newAction.Active = true; newAction.ItemName = "Converted webapisoap action"; newActivity.Acts.Add((ActWebAPISoap)newAction); mBF.Activities[1].Acts.Add(newAction); //Assert converted action Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual("Åland Islands", newAction.ReturnValues.FirstOrDefault(x => x.Param == @"m:sName").Actual); //Run newAction mGR.Executor.RunRunner(); //assert newaction Assert.AreNotEqual(0, newAction.ReturnValues.Count); Assert.AreEqual("Åland Islands", newAction.ReturnValues.FirstOrDefault(x => x.Param == @"m:sName").Actual); }
public static void ClassInitialize(TestContext TestContext) { string Connectionstring = "filename=" + TestResources.GetTestResourcesFile(@"Solutions" + Path.DirectorySeparatorChar + "BasicSimple" + Path.DirectorySeparatorChar + "DataSources" + Path.DirectorySeparatorChar + "LiteDB.db") + "; mode=Exclusive"; excelFilePath = TestResources.GetTestResourcesFile(@"Excel" + Path.DirectorySeparatorChar + "ExportedDS.xlsx"); liteDB.FileFullPath = Connectionstring; }
public static void ClassInitialize(TestContext TestContext) { string XmlfFilePath = TestResources.GetTestResourcesFile(@"XML" + Path.DirectorySeparatorChar + "XmlDoc.xml"); XDoc = new XmlDocument(); XDoc.Load(XmlfFilePath); XDE = new XMLDocExtended(XDoc); }
public void GenerateAPIfromWSDL() { // Arrange string filename = TestResources.GetTestResourcesFile(@"APIModel\globalweather.xml"); WSDLParser WSDLP = new WSDLParser(); //Act ObservableList <ApplicationAPIModel> AAMList = new ObservableList <ApplicationAPIModel>(); AAMList = WSDLP.ParseDocument(filename, AAMList); //Assert Assert.AreEqual(AAMList.Count, 4, "Objects count"); //Assert.AreEqual(AAMList[0].GroupName, "GlobalWeatherSoap", "binding name"); Assert.AreEqual(AAMList[0].Name, "GetWeather_GlobalWeatherSoap", "operation name"); Assert.AreEqual(AAMList[0].RequestBody.Length, 439, "operation name"); //Assert.AreEqual(AAMList[1].GroupName, "GlobalWeatherSoap", "binding name"); Assert.AreEqual(AAMList[1].Name, "GetCitiesByCountry_GlobalWeatherSoap", "operation name"); Assert.AreEqual(AAMList[1].RequestBody.Length, 357, "operation name"); //Assert.AreEqual(AAMList[2].GroupName, "GlobalWeatherSoap12", "binding name"); Assert.AreEqual(AAMList[2].Name, "GetWeather_GlobalWeatherSoap12", "operation name"); //Assert.AreEqual(AAMList[3].GroupName, "GlobalWeatherSoap12", "binding name"); Assert.AreEqual(AAMList[3].Name, "GetCitiesByCountry_GlobalWeatherSoap12", "operation name"); //Assert.AreEqual(AAMList[4].GroupName, "GlobalWeatherHttpGet", "binding name"); //Assert.AreEqual(AAMList[4].Name, "GlobalWeatherHttpGet_GetWeather", "operation name"); //Assert.AreEqual(AAMList[5].GroupName, "GlobalWeatherHttpGet", "binding name"); //Assert.AreEqual(AAMList[5].Name, "GlobalWeatherHttpGet_GetCitiesByCountry", "operation name"); //Assert.AreEqual(AAMList[6].GroupName, "GlobalWeatherHttpPost", "binding name"); //Assert.AreEqual(AAMList[6].Name, "GlobalWeatherHttpPost_GetWeather", "operation name"); //Assert.AreEqual(AAMList[7].GroupName, "GlobalWeatherHttpPost", "binding name"); //Assert.AreEqual(AAMList[7].Name, "GlobalWeatherHttpPost_GetCitiesByCountry", "operation name"); foreach (ApplicationAPIModel AAM in AAMList) { if ((AAMList.IndexOf(AAM) % 2) == 0) { Assert.AreEqual(AAM.AppModelParameters.Count, 2, "Dynamic Parameters count"); Assert.AreEqual(AAM.Description, "Get weather report for all major cities around the world.", "Description check"); Assert.AreEqual(AAM.RequestBody.Length, 439, "Request Body Length Check"); } else { Assert.AreEqual(AAM.AppModelParameters.Count, 1, "Dynamic Parameters count"); Assert.AreEqual(AAM.Description, "Get all major cities by country name(full / part).", "Description check"); Assert.AreEqual(AAM.RequestBody.Length, 357, "Request Body Length Check"); } //Assert.AreEqual(AAM.APIModelKeyValueHeaders.Count, 8, "KeyValueHeaders count"); Assert.AreEqual(AAM.EndpointURL, "http://www.webservicex.net/globalweather.asmx", "KeyValueHeaders count"); } }
public static void ClassInit(TestContext context) { Dictionary <string, string> param = new Dictionary <string, string>(); FilePath = TestResources.GetTestResourcesFile(@"SignUp.accdb"); param.Add("ConnectionString", @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FilePath + ";"); db.KeyvalParamatersList = param; Boolean testconn = db.OpenConnection(param); }
public static void ClassInit(TestContext context) { mAccessDBFile = TestResources.GetTestResourcesFile(@"SignUp.accdb"); accessDB = new MSAccessDBCon(); accessDB.Provider = "Microsoft.ACE.OLEDB.12.0"; accessDB.DataSource = mAccessDBFile; // accessDB.OpenConnection(); }
public void GetDependaciesForDataSourceUsingRegex() { //Arrange string filePath = TestResources.GetTestResourcesFile(@"Solutions" + Path.DirectorySeparatorChar + "GlobalCrossSolution" + Path.DirectorySeparatorChar + "BusinessFlows" + Path.DirectorySeparatorChar + "Flow 1.Ginger.BusinessFlow.xml"); //Act GlobalSolutionUtils.Instance.AddDependaciesForDataSource(filePath, ref SelectedItemsListToImport); //Assert Assert.IsNotNull(SelectedItemsListToImport.Where(x => x.ItemExtraInfo == "~\\\\DataSources\\AccessDS.Ginger.DataSource.xml")); }
public void ConditionValidationTest() { //Arrange string FileName = TestResources.GetTestResourcesFile(@"Solutions" + Path.DirectorySeparatorChar + "BasicSimple" + Path.DirectorySeparatorChar + "BusinessFlows" + Path.DirectorySeparatorChar + "ConditionVal.Ginger.BusinessFlow.xml"); //Load BF //Act BusinessFlow businessFlow = (BusinessFlow)RS.DeserializeFromFile(FileName); //Assert Assert.AreEqual(1, businessFlow.Activities[0].Acts[0].InputValues.Count); }