Ejemplo n.º 1
0
        public void NewCLIArgsRegressionTest()
        {
            //Arrange
            PrepareForCLICreationAndExecution();

            // Create args
            List <string> args = new List <string>();

            args.Add("run");

            args.Add("--solution");
            args.Add(mSolutionFolder);

            args.Add("--env");
            args.Add("Default");

            args.Add("--runset");
            args.Add("Default Run Set");

            args.Add("--do-not-analyze");

            args.Add("--showui");

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(args.ToArray());

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
        }
Ejemplo n.º 2
0
        public void CLIArgsTest()
        {
            // Arrange
            PrepareForCLICreationAndExecution();
            // Create config file
            CLIHelper cLIHelper = new CLIHelper();

            cLIHelper.RunAnalyzer       = true;
            cLIHelper.ShowAutoRunWindow = false;
            cLIHelper.DownloadUpgradeSolutionFromSourceControl = false;

            RunSetAutoRunConfiguration runSetAutoRunConfiguration = new RunSetAutoRunConfiguration(WorkSpace.Instance.Solution, WorkSpace.Instance.RunsetExecutor, cLIHelper);

            runSetAutoRunConfiguration.ConfigFileFolderPath = mTempFolder;
            runSetAutoRunConfiguration.SelectedCLI          = new CLIArgs();

            // Act
            CLIProcessor CLI = new CLIProcessor();

            string[] args = CommandLineToStringArray(runSetAutoRunConfiguration.CLIContent).ToArray();
            CLI.ExecuteArgs(args);

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
        }
Ejemplo n.º 3
0
        public void CLIDynamicJSON_CreateAndExecute_Test()
        {
            // Arrange
            PrepareForCLICreationAndExecution(runsetName: "Calc_Test");
            // Create config file
            CLIHelper cLIHelper = new CLIHelper();

            cLIHelper.RunAnalyzer       = true;
            cLIHelper.ShowAutoRunWindow = false;
            cLIHelper.DownloadUpgradeSolutionFromSourceControl = false;

            RunSetAutoRunConfiguration runSetAutoRunConfiguration = new RunSetAutoRunConfiguration(WorkSpace.Instance.Solution, WorkSpace.Instance.RunsetExecutor, cLIHelper);

            runSetAutoRunConfiguration.ConfigFileFolderPath = mTempFolder;
            runSetAutoRunConfiguration.SelectedCLI          = new CLIDynamicFile(CLIDynamicFile.eFileType.JSON);
            runSetAutoRunConfiguration.CreateContentFile();

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "dynamic", "-f", runSetAutoRunConfiguration.ConfigFileFullPath });

            // Assert
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name, "Calc_Test", "Validating correct Run set was executed");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].Name, "Calculator_Test", "Validating correct Business Flow was executed");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, eRunStatus.Passed, "Validating BF execution Passed");
        }
Ejemplo n.º 4
0
        public void CLIDynamicJSON_ExistingCustomized_OnlyIDs_Test()
        {
            // Arrange
            string jsonConfigFilePath = CreateTempJSONConfigFile(Path.Combine(TestResources.GetTestResourcesFolder("CLI"), "CLI-CustomExistingRunset_OnlyIDs.Ginger.AutoRunConfigs.json"), mSolutionFolder);

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "dynamic", "-f", jsonConfigFilePath });

            // Assert
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name, "Calc_Test", "Validating correct Run set was executed");

            //Envs Validation
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.RunsetExecutionEnvironment.Name, "Env1", "Validating correct customized Run set Environment");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].ProjEnvironment.Name, "Env2", "Validating correct customized Runner Environment");

            //Agent Validation
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].ApplicationAgents[0].AgentName, "IE", "Validating correct customized Runner Agent");

            //BF 1 Validation
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].Name, "Calculator_Test", "Validating correct Business Flow was executed");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].GetBFandActivitiesVariabeles(false).Where(x => x.Name == "DoMultiply?").FirstOrDefault().Value, "No", "Validating Customized BF level Selection List Variable");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].GetBFandActivitiesVariabeles(false).Where(x => x.Name == "SecondNum_ForSum").FirstOrDefault().Value, "44", "Validating Customized Activity level String Variable");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, eRunStatus.Passed, "Validating BF execution Passed");

            //BF 2 Validation (same instance of BF)
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[2].Name, "Calculator_Test", "Validating correct Business Flow was executed");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[2].GetBFandActivitiesVariabeles(false).Where(x => x.Name == "DoDivide?").FirstOrDefault().Value, "Yes", "Validating Customized BF level Selection List Variable");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[2].GetBFandActivitiesVariabeles(false).Where(x => x.Name == "SecondNum_ForDivide").FirstOrDefault().Value, "1", "Validating Customized Activity level String Variable");
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[2].RunStatus, eRunStatus.Passed, "Validating BF execution Passed");

            Assert.AreEqual(((RunSetActionHTMLReportSendEmail)(WorkSpace.Instance.RunsetExecutor.RunSetConfig.RunSetActions[0])).MailTo, "*****@*****.**", "Validating customized report mail Address");
            Assert.AreEqual(((RunSetActionHTMLReportSendEmail)(WorkSpace.Instance.RunsetExecutor.RunSetConfig.RunSetActions[0])).Subject, "Test44", "Validating customized report mail Subject");
        }
Ejemplo n.º 5
0
        public void CLIRunSetWithSendEmailReport()
        {
            //Arrange
            // Create config file
            CLIHelper cLIHelper = new CLIHelper();

            cLIHelper.RunAnalyzer       = true;
            cLIHelper.ShowAutoRunWindow = false;
            cLIHelper.DownloadUpgradeSolutionFromSourceControl = false;
            RunSetAutoRunConfiguration runSetAutoRunConfiguration = new RunSetAutoRunConfiguration(WorkSpace.Instance.Solution, WorkSpace.Instance.RunsetExecutor, cLIHelper);

            runSetAutoRunConfiguration.ConfigFileFolderPath = mTempFolder;
            runSetAutoRunConfiguration.SelectedCLI          = new CLIArgs();
            CLIProcessor CLI = new CLIProcessor();

            // Act
            CLI.ExecuteArgs(new string[] { runSetAutoRunConfiguration.SelectedCLI.Identifier + "=" + runSetAutoRunConfiguration.ConfigFileContent });
            string clientAppFilePath = Path.Combine(WorkSpace.Instance.LocalUserApplicationDataFolderPath, "Reports", "Ginger-Web-Client", "assets", "Execution_Data", "executiondata.js");
            bool   isFileExists      = File.Exists(clientAppFilePath);
            string jsDataStr         = File.ReadAllText(clientAppFilePath);

            //Artifacts
            // TODO: zip and upload the report - create it in temp folder
            // mTestHelper.AddTestArtifact("...\Report.zip" - zipFileName);

            //Assert
            Assert.IsTrue(jsDataStr.StartsWith("window.runsetData={\"GingerVersion\""), "jsDataStr.StartsWith(window.runsetData ={\"GingerVersion\"");
            Assert.AreEqual(true, isFileExists, "clientAppFilePath exist - " + clientAppFilePath);

            // TODO: verify the content of the jsDataStr
            //Assert.AreEqual(....
        }
Ejemplo n.º 6
0
        public void OLDCLIConfigTest()
        {
            // Arrange
            PrepareForCLICreationAndExecution();
            // Create config file
            CLIHelper cLIHelper = new CLIHelper();

            cLIHelper.RunAnalyzer       = true;
            cLIHelper.ShowAutoRunWindow = false;
            cLIHelper.DownloadUpgradeSolutionFromSourceControl = false;

            RunSetAutoRunConfiguration runSetAutoRunConfiguration = new RunSetAutoRunConfiguration(WorkSpace.Instance.Solution, WorkSpace.Instance.RunsetExecutor, cLIHelper);

            runSetAutoRunConfiguration.ConfigFileFolderPath = mTempFolder;
            runSetAutoRunConfiguration.SelectedCLI          = new CLIConfigFile();
            runSetAutoRunConfiguration.CreateContentFile();

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "ConfigFile=" + runSetAutoRunConfiguration.ConfigFileFullPath });

            // Assert
            Assert.AreEqual(WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, "BF RunStatus=Passed");
        }
Ejemplo n.º 7
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Console.WriteLine("Starting Ginger");

            if (e.Args.Length == 0)
            {
                // start regular Ginger UI
                StartGingerUI();
            }
            else
            {
                // handle CLI
                if (e.Args[0].StartsWith("ConfigFile"))
                {
                    // This Ginger is running with run set config will do the run and close GingerInitApp();
                    StartGingerExecutor();
                }
                else
                {
                    InitClassTypesDictionary();
                    Reporter.WorkSpaceReporter = new GingerWorkSpaceReporter();
                    CLIProcessor.ExecuteArgs(e.Args);
                    // do proper close !!!
                    System.Windows.Application.Current.Shutdown();
                }
            }
        }
Ejemplo n.º 8
0
 private async static void ProcessArgs(string[] args)
 {
     InitWorkSpace(false);
     WorkSpace.Instance.InitWorkspace(new GingerConsoleWorkspaceReporter(), new RepoCoreItem());
     CLIProcessor CLI = new CLIProcessor();
     await CLI.ExecuteArgs(args);
 }
Ejemplo n.º 9
0
        public void CLIScriptRegressionTest()
        {
            //lock (WorkSpace.Instance)
            //{

            //Arrange
            // PrepareForCLIExecution();
            // Create config file
            string scriptFile   = TestResources.GetTempFile("runset1.ginger.script");
            string jsonFileName = TestResources.GetTempFile("runset.json");
            string txt          = "int i=1;" + Environment.NewLine;

            txt += "i++;" + Environment.NewLine;
            txt += nameof(GingerScriptGlobals.OpenSolution) + "(@\"" + mSolutionFolder + "\");" + Environment.NewLine;
            txt += nameof(GingerScriptGlobals.OpenRunSet) + "(\"Default Run Set\", \"Default\");" + Environment.NewLine;          // Runset, env
            txt += nameof(GingerScriptGlobals.CreateExecutionSummaryJSON) + "(@\"" + jsonFileName + "\");" + Environment.NewLine; // summary json
            txt += "i" + Environment.NewLine;                                                                                     // script rc
            System.IO.File.WriteAllText(scriptFile, txt);

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "Script=" + scriptFile });

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
            //}
        }
Ejemplo n.º 10
0
        private async void RunNewCLI(string[] args)
        {
            CLIProcessor cLIProcessor = new CLIProcessor();
            await cLIProcessor.ExecuteArgs(args);

            // do proper close !!!
            System.Windows.Application.Current.Shutdown(Environment.ExitCode);
        }
Ejemplo n.º 11
0
 private async static void ProcessArgs(string[] args)
 {
     InitWorkSpace(false);
     WorkSpace.Instance.RunningInExecutionMode = true;
     Reporter.ReportAllAlsoToConsole           = true; //needed so all reporting will be added to Console
     WorkSpace.Instance.InitWorkspace(new GingerConsoleWorkspaceReporter(), new RepoCoreItem());
     CLIProcessor CLI = new CLIProcessor();
     await CLI.ExecuteArgs(args);
 }
Ejemplo n.º 12
0
        private void RunNewCLI(string[] args)
        {
            CLIProcessor cLIProcessor = new CLIProcessor();

            cLIProcessor.ExecuteArgs(args);

            // do proper close !!!
            System.Windows.Application.Current.Shutdown();
        }
Ejemplo n.º 13
0
        public void CLIVersion()
        {
            //Arrange
            PrepareForCLICreationAndExecution();

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "-t" });

            // Assert
            // ????
        }
Ejemplo n.º 14
0
        public void CLIHelp()
        {
            lock (mConsoleMessages)
            {
                //Arrange
                mConsoleMessages.Clear();
                CLIProcessor CLI = new CLIProcessor();

                // Act
                CLI.ExecuteArgs(new string[] { "help" });

                // Assert
                Assert.AreEqual(1, mConsoleMessages.Count, "message count");
                Assert.IsTrue(mConsoleMessages[0].MessageToConsole.Contains("Ginger support"), "help message");
            }
        }
Ejemplo n.º 15
0
        public void CLIBadParams()
        {
            lock (mConsoleMessages)
            {
                //Arrange
                mConsoleMessages.Clear();
                CLIProcessor CLI = new CLIProcessor();

                // Act
                CLI.ExecuteArgs(new string[] { "--blabla" });

                // Assert
                Assert.AreEqual(eLogLevel.ERROR, mConsoleMessages[0].LogLevel, "message loglevel is ERROR");
                Assert.AreEqual("Please fix the arguments and try again", mConsoleMessages[0].MessageToConsole, "console message");
            }
        }
Ejemplo n.º 16
0
        public void CLIArgsWithDoNotAnalyzeTest()
        {
            //Arrange
            PrepareForCLICreationAndExecution();
            // Create args
            string[] args = { "run", "--solution", mSolutionFolder, "--env", "Default", "--runset", "Default Run Set", "--do-not-analyze" };

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(args);

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");

            // TODO: test analyze was run !!!!
        }
Ejemplo n.º 17
0
        public void CLIGridWithoutParams()
        {
            lock (mConsoleMessages)
            {
                //Arrange
                mConsoleMessages.Clear();
                CLIProcessor CLI = new CLIProcessor();

                // Act
                CLI.ExecuteArgs(new string[] { "grid" });

                // Assert
                Assert.AreEqual(1, mConsoleMessages.Count, "There is 1 line of help");
                Assert.AreEqual(eLogLevel.INFO, mConsoleMessages[0].LogLevel, "message loglevel is ERROR");
                Assert.AreEqual("Starting Ginger Grid at port: 15001", mConsoleMessages[0].MessageToConsole, "console message");
            }
        }
Ejemplo n.º 18
0
        public void OLDCLIDynamicRegressionTest()
        {
            //Arrange
            //Create config file
            string fileName   = Path.Combine(TestResources.GetTestResourcesFolder("CLI"), "CLI-Default Run Set.Ginger.AutoRunConfigs.xml");
            string dynamicXML = System.IO.File.ReadAllText(fileName);

            dynamicXML = dynamicXML.Replace("SOLUTION_PATH", mSolutionFolder);
            string configFile = TestResources.GetTempFile("CLI-Default Run Set.Ginger.AutoRunConfigs.xml");

            System.IO.File.WriteAllText(configFile, dynamicXML);

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "Dynamic=" + configFile });

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
        }
Ejemplo n.º 19
0
        public void OLDCLIConfigRegressionTest()
        {
            //Arrange
            //Create config file
            PrepareForCLICreationAndExecution();
            string txt = string.Format("Solution={0}", mSolutionFolder) + Environment.NewLine;

            txt += string.Format("Env={0}", "Default") + Environment.NewLine;
            txt += string.Format("RunSet={0}", "Default Run Set") + Environment.NewLine;
            txt += string.Format("RunAnalyzer={0}", "True") + Environment.NewLine;
            txt += string.Format("ShowAutoRunWindow={0}", "False") + Environment.NewLine;
            string configFile = TestResources.GetTempFile("runset1.ginger.config");

            System.IO.File.WriteAllText(configFile, txt);

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "ConfigFile=" + configFile });

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
        }
Ejemplo n.º 20
0
        public void CLIArgsRegressionTest()
        {
            //lock (WorkSpace.Instance)
            //{
            //Arrange
            PrepareForCLICreationAndExecution();
            // Create args
            string args = string.Format("--solution {0}", mSolutionFolder);

            args += string.Format("--environment {0}", "Default");
            args += string.Format("--runset {0}", "Default Run Set");
            args += string.Format("--runAnalyzer {0}", "True");
            args += string.Format("--showAutoRunWindow {0}", "False");

            // Act
            CLIProcessor CLI = new CLIProcessor();

            CLI.ExecuteArgs(new string[] { "--args", args });

            // Assert
            Assert.AreEqual(eRunStatus.Passed, WorkSpace.Instance.RunsetExecutor.Runners[0].BusinessFlows[0].RunStatus, "BF RunStatus=Passed");
            //}
        }
Ejemplo n.º 21
0
        public void DynamicRunetExecutionTest()
        {
            //Arrange
            ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>();
            BusinessFlow BF1 = bfList[0];

            ObservableList <Activity> activityList = BF1.Activities;

            Activity activity = activityList[0];

            BF1.Active = true;

            GingerRunner mGRForRunset = new GingerRunner();

            mGRForRunset.Name = "Test Runner";

            Agent a = new Agent();

            a.DriverType = Agent.eDriverType.SeleniumChrome;

            mGRForRunset.SolutionAgents = new ObservableList <Agent>();
            mGRForRunset.SolutionAgents.Add(a);

            mGRForRunset.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = "SCM", Agent = a
            });
            mGRForRunset.SolutionApplications = new ObservableList <ApplicationPlatform>();
            mGRForRunset.SolutionApplications.Add(new ApplicationPlatform()
            {
                AppName = "SCM", Platform = ePlatformType.Web, Description = "New application"
            });

            mGRForRunset.BusinessFlows.Add(BF1);
            WorkSpace.Instance.SolutionRepository = SR;

            mGRForRunset.SpecificEnvironmentName = environment.Name;
            mGRForRunset.UseSpecificEnvironment  = false;

            RunSetConfig runSetConfig1 = new RunSetConfig();

            mGRForRunset.IsUpdateBusinessFlowRunList = true;
            runSetConfig1.GingerRunners.Add(mGRForRunset);

            runSetConfig1.UpdateRunnersBusinessFlowRunsList();
            runSetConfig1.mRunModeParallel = false;

            RunSetActionHTMLReport produceHTML2 = CreateProduceHTMlOperation();

            runSetConfig1.RunSetActions.Add(produceHTML2);

            RunsetExecutor GMR1 = new RunsetExecutor();

            GMR1.RunsetExecutionEnvironment = environment;
            GMR1.RunSetConfig = runSetConfig1;
            WorkSpace.Instance.RunsetExecutor = GMR1;
            CLIHelper cLIHelper1 = new CLIHelper();

            cLIHelper1.RunAnalyzer       = false;
            cLIHelper1.ShowAutoRunWindow = false;
            cLIHelper1.DownloadUpgradeSolutionFromSourceControl = false;

            RunSetAutoRunConfiguration autoRunConfiguration1 = new RunSetAutoRunConfiguration(solution, GMR1, cLIHelper1);
            CLIDynamicFile             mCLIDynamicXML1       = new CLIDynamicFile(CLIDynamicFile.eFileType.XML);

            autoRunConfiguration1.SelectedCLI = mCLIDynamicXML1;
            String xmlFile = autoRunConfiguration1.SelectedCLI.CreateConfigurationsContent(solution, GMR1, cLIHelper1);

            autoRunConfiguration1.CreateContentFile();

            CLIProcessor cLIProcessor = new CLIProcessor();

            string[] args = new string[] { autoRunConfiguration1.SelectedCLI.Verb, "--" + CLIOptionClassHelper.FILENAME, autoRunConfiguration1.ConfigFileFullPath };

            //Act
            cLIProcessor.ExecuteArgs(args);

            //Assert
            string path = TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "BasicSimple" + Path.DirectorySeparatorChar + "Reports" + Path.DirectorySeparatorChar + "Reports");

            Assert.IsTrue(Directory.Exists(path));
        }