Exemplo n.º 1
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");
        }
Exemplo 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");
        }
Exemplo 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");
        }
Exemplo n.º 4
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(....
        }
Exemplo n.º 5
0
        public AutoRunWizard(RunSetConfig runSetConfig, Context context)
        {
            RunsetConfig         = runSetConfig;
            mContext             = context;
            CliHelper            = new CLIHelper();
            AutoRunConfiguration = new RunSetAutoRunConfiguration(WorkSpace.Instance.Solution, WorkSpace.Instance.RunsetExecutor, CliHelper);
            AutoRunShortcut      = new RunSetAutoRunShortcut(AutoRunConfiguration);

            AddPage(Name: "Introduction", Title: "Introduction", SubTitle: "Auto Run Configuration Introduction", Page: new WizardIntroPage("/RunSetLib/CreateAutoRunWizardLib/AutoRunIntroduction.md"));
            AddPage(Name: "General Options", Title: "General Options", SubTitle: "Set Auto Run General Options", Page: new AutoRunWizardOptionsPage());
            AddPage(Name: "Configuration Type", Title: "Configuration Type", SubTitle: "Set Auto Run Configuration Type", Page: new AutoRunWizardCLITypePage());
            AddPage(Name: "Execution Shortcut", Title: "Execution Shortcut", SubTitle: "Create Auto Run Configuration Execution Shortcut", Page: new AutoRunWizardShortcutPage());
        }
Exemplo n.º 6
0
        public void DyanamicRunsetXMLCreationTest()
        {
            //Arrange
            RunSetConfig runSetConfigurations = CreteRunsetWithOperations();

            RunsetExecutor GMR = new RunsetExecutor();

            GMR.RunsetExecutionEnvironment = environment;
            GMR.RunSetConfig = runSetConfigurations;

            CLIHelper cLIHelper = new CLIHelper();

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

            RunSetAutoRunConfiguration autoRunConfiguration = new RunSetAutoRunConfiguration(solution, GMR, cLIHelper);
            CLIDynamicFile             mCLIDynamicXML       = new CLIDynamicFile(CLIDynamicFile.eFileType.XML);

            autoRunConfiguration.SelectedCLI = mCLIDynamicXML;

            //Act
            //Creating XML file content from above configurations
            string file = autoRunConfiguration.SelectedCLI.CreateConfigurationsContent(solution, GMR, cLIHelper);

            //Assert
            //validate the 'AddRunsetOperation' tag
            XElement nodes = XElement.Parse(file);

            List <XElement> AddRunsetOPerationsNodes = nodes.Elements("AddRunsetOperation").ToList();

            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(file);
            XmlNodeList runsetoperations = xDoc.GetElementsByTagName("AddRunsetOperation");

            //Assert
            Assert.AreEqual(runsetoperations.Count, 3);
            Assert.AreEqual(runsetoperations[0].FirstChild.Name, "MailFrom");
            Assert.AreEqual(runsetoperations[0].LastChild.Name, "IncludeAttachmentReport");
            Assert.AreEqual(runsetoperations[1].FirstChild.Name, "HTMLReportFolderName");
            Assert.AreEqual(runsetoperations[1].LastChild.Name, "isHTMLReportPermanentFolderNameUsed");
            Assert.AreEqual(runsetoperations[2].HasChildNodes, false);
        }
Exemplo n.º 7
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));
        }