private void InitControls() { //TODO: uncomments once we have BusinessFlowsFolderTreeItem which get RF //RepositoryFolder<BusinessFlow> RF1 = mSolutionRepository.GetRepositoryItemRootFolder<BusinessFlow>(); //BusinessFlowsFolderTreeItem t = new BusinessFlowsFolderTreeItem(RF1); //TVFrame.SetContent(new TreeViewExplorerPage(t)); RepositoryFolder <BusinessFlow> RF2 = mSolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>(); ObservableList <BusinessFlow> BFs = RF2.GetFolderItems(); Grid1.ItemsSource = BFs; RepositoryFolder <BusinessFlow> RF3 = mSolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>(); ObservableList <BusinessFlow> BFs2 = RF3.GetFolderItems(); Grid2.ItemsSource = BFs2; // EnvsComboBox.in EnvsListBox.ItemsSource = mSolutionRepository.GetAllRepositoryItems <ProjEnvironment>(); EnvsListBox.DisplayMemberPath = nameof(ProjEnvironment.Name); EnvsComboBox.ItemsSource = mSolutionRepository.GetAllRepositoryItems <ProjEnvironment>(); EnvsComboBox.DisplayMemberPath = nameof(ProjEnvironment.Name); // Go get first env Guid Guid guid = mSolutionRepository.GetAllRepositoryItems <ProjEnvironment>()[0].Guid; ProjEnvironment env1 = mSolutionRepository.GetRepositoryItemByGuid <ProjEnvironment>(guid); EnvNameTextBox.BindControl(env1, nameof(ProjEnvironment.Name)); AllBFsListBox.ItemsSource = mSolutionRepository.GetAllRepositoryItems <BusinessFlow>(); AllBFsListBox.DisplayMemberPath = nameof(BusinessFlow.Name); }
private void AddEnvButton_Click(object sender, RoutedEventArgs e) { ProjEnvironment env = new ProjEnvironment(); env.Name = "New Env " + DateTime.Now; mSolutionRepository.AddRepositoryItem(env); }
public void SetRunnersEnv(ProjEnvironment defualtEnv, ObservableList <ProjEnvironment> allEnvs) { foreach (GingerRunner GR in Runners) { GR.SetExecutionEnvironment(defualtEnv, allEnvs); } }
/// <summary> /// Static function to calculate string Expression like: "{Var Name=v1}" /// </summary> /// <param name="ProjEnvironment">Env is used for Env Params</param> /// <param name="BusinessFlow">Business Flow containing the Variables</param> /// <param name="Value">the Expression string</param> /// <returns></returns> public static string Calculate(ProjEnvironment ProjEnvironment, BusinessFlow BusinessFlow, string Value, ObservableList <DataSourceBase> DSList, bool bUpdate = false, string UpdateValue = "") { //TODO: this is static func, we can later on do cache and other stuff for performence if needed ValueExpression VE = new ValueExpression(ProjEnvironment, BusinessFlow, DSList, bUpdate, UpdateValue); VE.Value = Value; return(VE.ValueCalculated); }
private void Duplicate(object sender, RoutedEventArgs e) { EnvApplication copy = (EnvApplication)EnvApplication.CreateCopy(); copy.Name = copy.Name + "_copy"; ProjEnvironment.Applications.Add(copy); ProjEnvironment.SaveBackup();//to mark the env as changed }
private void Duplicate(object sender, RoutedEventArgs e) { EnvApplication copy = (EnvApplication)EnvApplication.CreateCopy(); copy.Name = copy.Name + "_copy"; ProjEnvironment.Applications.Add(copy); ProjEnvironment.SaveBackup();//to mark the env as changed mTreeView.Tree.RefreshSelectedTreeNodeParent(); }
public ValueExpression(ProjEnvironment Env, BusinessFlow BF, ObservableList <DataSourceBase> DSList = null, bool bUpdate = false, string UpdateValue = "", bool bDone = true) { this.Env = Env; this.BF = BF; this.DSList = DSList; this.bUpdate = bUpdate; this.updateValue = UpdateValue; this.bDone = bDone; }
Page ITreeViewItem.EditPage() { ProjEnvironment.SaveBackup();//to mark the env as changed if (mApplicationPage == null) { mApplicationPage = new ApplicationPage(EnvApplication); } return(mApplicationPage); }
//ExecutionLogger executionLogger; void RunFlow(BusinessFlow businessFlow) { GingerRunner gingerRunner = new GingerRunner(); ExecutionLogger ex = (ExecutionLogger)gingerRunner.RunListeners[0]; // temp until we remove it from GR constructor and add manually ex.ExecutionLogfolder = jsonDumpFolder; ex.Configuration.ExecutionLoggerConfigurationIsEnabled = true; //ex.exec // ex.Configuration.exe // TODO: add dumper ProjEnvironment projEnvironment = new ProjEnvironment(); //ExecutionDumperListener executionDumperListener = new ExecutionDumperListener(@"c:\temp\dumper"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! temp //gingerRunner.RunListeners.Add(executionDumperListener); // executionLogger = new ExecutionLogger(projEnvironment, eExecutedFrom.Automation); // executionLogger.Configuration.ExecutionLoggerConfigurationIsEnabled = true; // gingerRunner.RunListeners.Add(executionLogger); gingerRunner.BusinessFlows.Clear(); gingerRunner.BusinessFlows.Add(businessFlow); gingerRunner.CurrentBusinessFlow = businessFlow; gingerRunner.RunRunner(); Console.WriteLine("Execution Completed"); Console.WriteLine("----------------------------"); Console.WriteLine("Elapsed: " + businessFlow.Elapsed); Console.WriteLine("Business Flow: " + businessFlow.Name); Console.WriteLine("Business Flow Description: " + businessFlow.Description); Console.WriteLine("Business Flow Status: " + businessFlow.RunStatus); Console.WriteLine("Activities Count: " + businessFlow.Activities.Count); Console.WriteLine("----------------------------"); foreach (Activity activity in businessFlow.Activities) { Console.WriteLine("Activity: " + activity.ActivityName + " Status: " + activity.Status); Console.WriteLine("Actions Found:" + activity.Acts.Count); foreach (Act act in activity.Acts) { Console.WriteLine("--"); Console.WriteLine("Action:" + act.Description); Console.WriteLine("Description:" + act.ActionDescription); Console.WriteLine("Type:" + act.ActionType); Console.WriteLine("Class:" + act.ActClass); Console.WriteLine("Status:" + act.Status); Console.WriteLine("Error:" + act.Error); Console.WriteLine("ExInfo:" + act.ExInfo); } Console.WriteLine("----------"); } GenerateReport(businessFlow); //TODO: create report }
/// <summary> /// Should be deleted after switch will be fully done to serialized objects /// </summary> public ReportInfo(ProjEnvironment Env, GingerRunner GR, bool ReportOnlyExecuted = false) // to remove after discussion !!! { mProjEnvironment = Env; mBFESs = GR.GetAllBusinessFlowsExecutionSummary(ReportOnlyExecuted); TotalExecutionTime = TimeSpan.FromMilliseconds(GR.Elapsed.GetValueOrDefault()); DateCreated = DateTime.Now.ToString(); DateCreatedShort = DateTime.Now.ToString("MM/dd"); ExecutionEnv = mProjEnvironment.Name; ExecutionElapsedTime = TotalExecutionTime; }
private void SetEnvironments() { specificEnvComboBox.ItemsSource = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>(); specificEnvComboBox.DisplayMemberPath = nameof(ProjEnvironment.Name); specificEnvComboBox.SelectedValuePath = nameof(ProjEnvironment.Guid); ProjEnvironment selectedEnv = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>().Where(x => x.Name == mGingerRunner.SpecificEnvironmentName).FirstOrDefault(); if (selectedEnv != null) { specificEnvComboBox.SelectedItem = selectedEnv; } }
public void AddEnvUsingWizard() { //Arrange EnvironmentsPOM EnvsPOM = mGingerAutomator.MainWindowPOM.GotoEnvironments(); //Act EnvsPOM.CreateEnvironment("bbb"); EnvsPOM.SelectEnvironment("bbb"); ProjEnvironment bbbEnv = (from x in amdocs.ginger.GingerCoreNET.WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>() where x.Name == "bbb" select x).SingleOrDefault(); // assert Assert.AreEqual("bbb", bbbEnv.Name); }
Page ITreeViewItem.EditPage(Amdocs.Ginger.Common.Context mContext) { ProjEnvironment.SaveBackup();//to mark the env as changed ProjEnvironment.StartDirtyTracking(); if (mApplicationPage == null) { mApplicationPage = new ApplicationPage(EnvApplication, new Context() { Environment = ProjEnvironment }); } return(mApplicationPage); }
public async void OpenRunSet(string runSetName, string envName) { SolutionRepository SR = WorkSpace.Instance.SolutionRepository; var envs = SR.GetAllRepositoryItems <ProjEnvironment>(); ProjEnvironment projEnvironment = (from x in SR.GetAllRepositoryItems <ProjEnvironment>() where x.Name == envName select x).SingleOrDefault(); RunSetConfig runSetConfig = (from x in SR.GetAllRepositoryItems <RunSetConfig>() where x.Name == runSetName select x).SingleOrDefault(); RunsetExecutor runsetExecutor = new RunsetExecutor(); WorkSpace.Instance.RunsetExecutor = runsetExecutor; runsetExecutor.RunSetConfig = runSetConfig; runsetExecutor.RunsetExecutionEnvironment = projEnvironment; runsetExecutor.InitRunners(); await runsetExecutor.RunRunset(); }
public void EnvironmentDeserializationTest() { //Arrange RepositorySerializer RepositorySerializer = new RepositorySerializer(); string sFileName = TestResources.GetTestResourcesFile(@"Converter" + Path.DirectorySeparatorChar + "CMI.Ginger.Environment.xml"); //Act ProjEnvironment env = (ProjEnvironment)RepositorySerializer.DeserializeFromFile(typeof(ProjEnvironment), sFileName); //Assert Assert.AreEqual(env.Name, "CMI IIS test server"); Assert.AreEqual(env.Applications.Count, 2); //TODO: add more asserts }
public void VerifyEnvsShowinTree() { //Arrange EnvironmentsPOM EnvsPOM = mGingerAutomator.MainWindowPOM.GotoEnvironments(); //Act ProjEnvironment env1 = EnvsPOM.SelectEnvironment("Default"); EnvsPOM.SelectEnvironment("UAT"); EnvsPOM.SelectEnvironment("ST"); // assert Assert.AreEqual("Default", env1.Name); }
/// <summary> /// Should be deleted after switch will be fully done to serialized objects /// </summary> public ReportInfo(ProjEnvironment Env, RunsetExecutor GMR, bool ReportOnlyExecuted = false) // to remove after discussion !!! { mProjEnvironment = Env; mBFESs = GMR.GetAllBusinessFlowsExecutionSummary(ReportOnlyExecuted); mGingersMultiRun = GMR; // Set all General info TotalExecutionTime = mGingersMultiRun.Elapsed; DateCreated = DateTime.Now.ToString(); DateCreatedShort = DateTime.Now.ToString("MM/dd"); ExecutionEnv = mProjEnvironment.Name; ExecutionElapsedTime = mGingersMultiRun.Elapsed; }
public void TestInitialize() { TargetFrameworkHelper.Helper = new DotNetFrameworkHelper(); mEnv = new ProjEnvironment(); EnvApplication app1 = new EnvApplication(); app1.Name = "App1"; app1.Url = "URL123"; mEnv.Applications.Add(app1); Database db1 = new Database(); db1.Name = "DB1"; app1.Dbs.Add(db1); GeneralParam GP1 = new GeneralParam(); GP1.Name = "GP1"; GP1.Value = "GP1Value"; app1.GeneralParams.Add(GP1); mBF = new BusinessFlow(); VariableString v1 = new VariableString(); v1.Name = "v1"; v1.Value = v1Value; //mBF.Variables.Add(v1); mBF.AddVariable(v1); VariableString v2 = new VariableString(); v2.Name = "v2"; v2.Value = v2Value; //mBF.Variables.Add(v2); mBF.AddVariable(v2); VariableString v3 = new VariableString(); v3.Name = "v3"; v3.Value = v3Value; //mBF.Variables.Add(v3); mBF.AddVariable(v3); VariableString v4 = new VariableString(); v4.Name = "v4"; v4.Value = v4Value; //mBF.Variables.Add(v4); mBF.AddVariable(v4); }
public void VerifyEnvcopyIsOK() { //Arrange string EnvName = "E1"; ObservableList <ProjEnvironment> allEnvs = mSolutionRepository.GetAllRepositoryItems <ProjEnvironment>(); ProjEnvironment env1 = (from x in allEnvs where x.Name == EnvName select x).SingleOrDefault(); //Act ProjEnvironment env1Copy = (ProjEnvironment)env1.CreateCopy(false); //Assert Assert.AreEqual(EnvName, env1.Name); Assert.AreEqual(EnvName, env1Copy.Name); Assert.AreEqual(env1.Guid, env1Copy.Guid); }
private static void CreateTestSolution() { // First we create a basic solution with some sample items SolutionRepository SR = new SolutionRepository(); string TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp"); if (Directory.Exists(TempRepositoryFolder)) { Directory.Delete(TempRepositoryFolder, true); } SR = Ginger.App.CreateGingerSolutionRepository(); SR.Open(TempRepositoryFolder); ProjEnvironment E1 = new ProjEnvironment() { Name = "E1" }; SR.AddRepositoryItem(E1); //RepositoryFolder<MyRepositoryItem> BFRF = SR.GetRepositoryItemRootFolder<MyRepositoryItem>(); //RepositoryFolder<MyRepositoryItem> SubFolder1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SubFolder1"); //BFRF.AddSubFolder("EmptySubFolder"); //MyRepositoryItem BF4 = new MyRepositoryItem("A4"); //SubFolder1.AddRepositoryItem(BF4); //// Folder to delete later //BFRF.AddSubFolder("SubFolderForDelete"); //// Create folders tree //RepositoryFolder<MyRepositoryItem> SF1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SF1"); //RepositoryFolder<MyRepositoryItem> SF2 = (RepositoryFolder<MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2"); //RepositoryFolder<MyRepositoryItem> SF3 = (RepositoryFolder<MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3"); //MyRepositoryItem BF5 = new MyRepositoryItem("A5"); //SubFolder1.AddRepositoryItem(BF5); //MyRepositoryItem BF6 = new MyRepositoryItem("A6"); //SF3.AddRepositoryItem(BF6); //TODO: add more sample items for testing SR.Close(); }
private void SelectEnv() { Reporter.ToLog(eLogLevel.DEBUG, "Selected Environment: '" + Env + "'"); ProjEnvironment env = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>().Where(x => x.Name.ToLower().Trim() == Env.ToLower().Trim()).FirstOrDefault(); if (env != null) { mRunsetExecutor.RunsetExecutionEnvironment = env; } else { Reporter.ToLog(eLogLevel.ERROR, "Failed to find matching Environment in the Solution"); // TODO: throw // return false; } }
public AppsListPage(ProjEnvironment env) { InitializeComponent(); AppEnvironmnet = env; //Set grid look and data SetGridView(); SetGridData(); App.ObjFieldBinding(EnvNameTextBox, TextBox.TextProperty, env, ProjEnvironment.Fields.Name); grdApps.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddApp)); grdApps.AddToolbarTool("@Share_16x16.png", "Add Selected Applications to All Environments", new RoutedEventHandler(AddAppsToOtherEnvironments)); TagsViewer.Init(AppEnvironmnet.Tags); }
internal BusinessFlowReport GetBFReportData(BusinessFlow businessFlow, ProjEnvironment environment) { BusinessFlowReport BFR = new BusinessFlowReport(businessFlow); BFR.VariablesBeforeExec = businessFlow.VariablesBeforeExec; BFR.SolutionVariablesBeforeExec = businessFlow.SolutionVariablesBeforeExec; BFR.Seq = this.ExecutionLogBusinessFlowsCounter; if (!string.IsNullOrEmpty(businessFlow.RunDescription)) { if (mVE == null) { mVE = new GingerCore.ValueExpression(environment, businessFlow, new ObservableList <GingerCore.DataSource.DataSourceBase>(), false, "", false); } mVE.Value = businessFlow.RunDescription; BFR.RunDescription = mVE.ValueCalculated; } return(BFR); }
public void EnvRenameshouldKeepOriginalFileName() { //Arrange ProjEnvironment env1 = new ProjEnvironment() { Name = "EV1" }; mSolutionRepository.AddRepositoryItem(env1); string filePath = env1.FilePath; //Act env1.Name = "EV1 A"; //env1.Save(); //Assert Assert.AreEqual(filePath, env1.FilePath); }
public static void ClassInit(TestContext context) { Platform p = new Platform(); p.PlatformType = ePlatformType.Web; if (WorkSpace.Instance != null && WorkSpace.Instance.Solution != null && WorkSpace.Instance.Solution.LoggerConfigurations != null) { string TempRepositoryFolder = TestResources.GetTestTempFolder(Path.Combine("Solutions", "temp")); WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder = Path.Combine(TempRepositoryFolder, "ExecutionResults"); } mGR = new GingerRunner(); mGR.Executor = new GingerExecutionEngine(mGR); mGR.Name = "Test Runner"; mGR.Executor.CurrentSolution = new Ginger.SolutionGeneral.Solution(); environment = new ProjEnvironment(); environment.Name = "Default"; //BF1.Environment = environment.Name; Agent a = new Agent(); a.DriverType = Agent.eDriverType.SeleniumChrome; ((GingerExecutionEngine)mGR.Executor).SolutionAgents = new ObservableList <Agent>(); ((GingerExecutionEngine)mGR.Executor).SolutionAgents.Add(a); mGR.ApplicationAgents.Add(new ApplicationAgent() { AppName = "SCM", Agent = a }); mGR.Executor.SolutionApplications = new ObservableList <ApplicationPlatform>(); mGR.Executor.SolutionApplications.Add(new ApplicationPlatform() { AppName = "SCM", Platform = ePlatformType.Web, Description = "New application" }); //mGR.BusinessFlows.Add(BF1); }
public AppsListPage(ProjEnvironment env) { InitializeComponent(); AppEnvironmnet = env; //Set grid look and data SetGridView(); SetGridData(); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(EnvNameTextBox, TextBox.TextProperty, env, ProjEnvironment.Fields.Name); xShowIDUC.Init(AppEnvironmnet); BindingHandler.ObjFieldBinding(xPublishcheckbox, CheckBox.IsCheckedProperty, AppEnvironmnet, nameof(RepositoryItemBase.Publish)); grdApps.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddApp)); grdApps.AddToolbarTool("@Share_16x16.png", "Add Selected Applications to All Environments", new RoutedEventHandler(AddAppsToOtherEnvironments)); TagsViewer.Init(AppEnvironmnet.Tags); }
/// <summary> /// Fill the environments Applications combo box /// </summary> private void FillAppComboBox() { // TODO: if there is only one item in the combo auto select it AppNameComboBox.Items.Clear(); string envName = App.MainWindow.lstEnvs.Text; //pe = (from e in App.LocalRepository.getAllEnvs() where e.Name == envName select e).FirstOrDefault(); pe = (from e in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>() where e.Name == envName select e).FirstOrDefault(); if (pe == null) { return; } foreach (EnvApplication ea in pe.Applications) { AppNameComboBox.Items.Add(ea.Name); } ComboAutoSelectIfOneItemOnly(AppNameComboBox); }
/// <summary> /// Fill the environments Applications combo box /// </summary> private void FillAppComboBox() { AppNameComboBox.Items.Clear(); if (Context.GetAsContext(mAct.Context) != null && Context.GetAsContext(mAct.Context).Environment != null) { pe = (from e in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>() where e.Name == Context.GetAsContext(mAct.Context).Environment.Name select e).FirstOrDefault(); if (pe == null) { return; } foreach (EnvApplication ea in pe.Applications) { AppNameComboBox.Items.Add(ea.Name); } ComboAutoSelectIfOneItemOnly(AppNameComboBox); } }
/// <summary> /// Should be deleted after switch will be fully done to serialized objects /// </summary> public ReportInfo(ProjEnvironment Env, BusinessFlow BF, GingerRunner GR = null) // to remove after discussion !!! { mProjEnvironment = Env; mBFESs = new ObservableList <BusinessFlowExecutionSummary>(); BusinessFlowExecutionSummary BFES = new BusinessFlowExecutionSummary(); BFES.BusinessFlowName = BF.Name; BFES.BusinessFlowRunDescription = BF.RunDescription; BFES.Status = BF.RunStatus; BFES.Activities = BF.Activities.Count; BFES.Actions = BF.GetActionsCount(); BFES.Validations = BF.GetValidationsCount(); BFES.ExecutionVariabeles = BF.GetBFandActivitiesVariabeles(true); BFES.BusinessFlow = BF; BFES.Selected = true; if (GR != null) { BFES.BusinessFlowExecLoggerFolder = Path.Combine(GR.ExecutionLoggerManager.ExecutionLogfolder, BF.ExecutionLogFolder); } if (mBFESs != null) { mBFESs.Clear(); } mBFESs.Add(BFES); mGingersMultiRun = null; // Set all General info if (BF.Elapsed != null) { TotalExecutionTime = TimeSpan.FromSeconds((long)BF.ElapsedSecs); } else { TotalExecutionTime = new TimeSpan(0); } ExecutionElapsedTime = TotalExecutionTime; DateCreated = DateTime.Now.ToString(); ExecutionEnv = mProjEnvironment.Name; DateCreatedShort = DateTime.Now.ToString("MM/dd"); }
public void ChangeEnvNameOnDiskUpdateObjandShowinTree() { //Arrange string EnvName = "Env to rename"; string EnvNewName = "Env to rename ZZZ"; EnvironmentsPOM EnvsPOM = mGingerAutomator.MainWindowPOM.GotoEnvironments(); EnvsPOM.CreateEnvironment(EnvName); ProjEnvironment env = EnvsPOM.SelectEnvironment(EnvName); //Act string txt = File.ReadAllText(env.FilePath); txt = txt.Replace(EnvName, EnvNewName); File.WriteAllText(env.FilePath, txt); bool b = EnvsPOM.EnvironmentsTree.IsItemExist(EnvNewName); // assert Assert.AreEqual(EnvNewName, env.Name); Assert.IsTrue(b); }