示例#1
0
        //[Timeout(60000)]
        public void ActivityVariablesDependancyTest()
        {
            //Arrange
            ObservableList <Activity> activityList = BF1.Activities;

            BF1.EnableActivitiesVariablesDependenciesControl = true;

            //Added selection list variable in BF
            VariableSelectionList selectionList = new VariableSelectionList();

            selectionList.OptionalValuesList.Add(new OptionalValue("a"));
            selectionList.OptionalValuesList.Add(new OptionalValue("b"));
            selectionList.SelectedValue = selectionList.OptionalValuesList[0].Value;
            selectionList.ItemName      = "MyVar";
            BF1.Variables.Add(selectionList);

            //Added dependancies in activities

            string[] variableValues = { "a", "b" };

            VariableDependency actiVD0 = new VariableDependency(selectionList.Guid, selectionList.ItemName, variableValues);

            activityList[0].VariablesDependencies.Add(actiVD0);

            VariableDependency actiVD1 = new VariableDependency(selectionList.Guid, selectionList.ItemName, variableValues);

            activityList[1].VariablesDependencies.Add(actiVD1);

            VariableDependency actiVD2 = new VariableDependency(selectionList.Guid, selectionList.ItemName, variableValues[1]);

            activityList[2].VariablesDependencies.Add(actiVD2);

            //Act
            mGR.RunBusinessFlow(BF1);

            //Assert
            Assert.AreEqual(BF1.Activities[0].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
            Assert.AreEqual(BF1.Activities[1].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
            Assert.AreEqual(BF1.Activities[2].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Skipped);

            //Changed the selected value of selection list
            ((VariableSelectionList)BF1.Variables[0]).SelectedValue = selectionList.OptionalValuesList[1].Value;

            //Act
            mGR.RunBusinessFlow(BF1);

            //Assert
            Assert.AreEqual(BF1.Activities[0].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
            Assert.AreEqual(BF1.Activities[1].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
            Assert.AreEqual(BF1.Activities[2].Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
        }
示例#2
0
        public void RunFlow()
        {
            //Arrange
            WorkSpace.LockWS();
            Agent        agent = prep();
            BusinessFlow BF    = new BusinessFlow("BF1");

            BF.TargetApplications.Add(new TargetApplication()
            {
                AppName = cWebApp
            });
            BF.Activities[0].TargetApplication = cWebApp;
            ActPlugIn a1 = new ActPlugIn()
            {
                PluginId = mPluginId, ServiceId = mServiceId, ActionId = "A1", Active = true
            };

            BF.Activities[0].Acts.Add(a1);

            //Act
            mGingerRunner.RunBusinessFlow(BF);
            Console.WriteLine("a1.Error = " + a1.Error);
            agent.Close();

            //Assert
            Assert.IsTrue(string.IsNullOrEmpty(a1.Error), "Action.Error=null");
            Assert.AreEqual(eRunStatus.Passed, a1.Status, "a1.Status");
            Assert.AreEqual(eRunStatus.Passed, BF.Activities[0].Status, "Activity Status = Pass");
            WorkSpace.RelWS();
        }
        public void RunFlowAndCreateReport()
        {
            //Arrange
            BusinessFlow mBF = new BusinessFlow();

            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF TEst timeline events listener";
            mBF.Active     = true;
            Activity activitiy1 = new Activity()
            {
                Active = true
            };

            activitiy1.Active = true;
            mBF.Activities.Add(activitiy1);
            ActDummy action1 = new ActDummy()
            {
                Description = "Dummay action 1", Active = true
            };

            activitiy1.Acts.Add(action1);
            mGingerRunner.BusinessFlows.Add(mBF);
            RunListenerBase.Start();
            mGingerRunner.RunBusinessFlow(mBF);

            //Act
            NewHTMLReport newHTMLReport = new NewHTMLReport();
            ReportInfo    reportInfo    = new ReportInfo("aaa"); // !!!!!!!!!!!!!!!
            string        s             = newHTMLReport.CreateReport(reportInfo);


            //Assert
            // Assert.AreEqual(1, events.Count, "Events count");
        }
示例#4
0
        private void RunBusinessFlow()
        {
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + "Name?");
            string       BizFlowName  = Console.ReadLine();
            BusinessFlow businessFlow = (from x in SR.GetAllRepositoryItems <BusinessFlow>() where x.Name == BizFlowName select x).SingleOrDefault();

            if (businessFlow == null)
            {
                Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " not found");
                return;
            }
            GingerRunner gingerRunner = new GingerRunner();

            gingerRunner.RunBusinessFlow(businessFlow, true);

            Console.WriteLine("Execution Completed");
            Console.WriteLine("----------------------------");
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Description: " + businessFlow.Description);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Status: " + businessFlow.RunStatus);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.Activities) + " Count: " + businessFlow.Activities.Count);
            Console.WriteLine("----------------------------");
            foreach (Activity activity in businessFlow.Activities)
            {
                Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.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("----------");
            }
        }
示例#5
0
        public void ExecutionListenerSimple()
        {
            //Arrange
            BusinessFlow mBF = new BusinessFlow();

            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF TEst timeline events listener";
            mBF.Active     = true;
            Activity activitiy1 = new Activity()
            {
                Active = true
            };

            activitiy1.Active = true;
            mBF.Activities.Add(activitiy1);

            ActDummy action1 = new ActDummy()
            {
                Description = "Dummay action 1", Active = true
            };

            activitiy1.Acts.Add(action1);
            mGingerRunner.BusinessFlows.Add(mBF);


            //Act
            RunListenerBase.Start();
            mGingerRunner.RunBusinessFlow(mBF);

            mExecutionLogger.ExecutionLogBusinessFlowsCounter = 1;


            //Assert



            //TimeLineEvent actionLineEvent = activityTimeLineEvent.ChildrenList[1];
            //Assert.IsTrue(actionLineEvent.Start != 0, "Action TimeLine Event.Start !=0");
            //Assert.IsTrue(actionLineEvent.End != 0, "Action TimeLine Event.End !=0");
            //Assert.AreEqual("Action", actionLineEvent.ItemType, "ItemType");
        }
示例#6
0
        private void RunBusinessFlow()
        {
            Console.WriteLine("Business Flow Name?");
            string       BizFlowName  = Console.ReadLine();
            BusinessFlow businessFlow = (from x in SR.GetAllRepositoryItems <BusinessFlow>() where x.Name == BizFlowName select x).SingleOrDefault();

            if (businessFlow == null)
            {
                Console.WriteLine("Business Flow not found");
                return;
            }
            GingerRunner gingerRunner = new GingerRunner();

            gingerRunner.RunBusinessFlow(businessFlow, true);

            Console.WriteLine("Execution completed");
            Console.WriteLine("BF Status: " + businessFlow.Status);
            foreach (Activity activity in businessFlow.Activities)
            {
                Console.WriteLine("Activity: " + activity.ActivityName + " Status: " + activity.Status);
            }
        }
        public void TimeLineListener()
        {
            //Arrange
            BusinessFlow mBF = new BusinessFlow();

            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF TEst time-line events listener";
            mBF.Active     = true;
            Activity activitiy1 = new Activity()
            {
                Active = true
            };

            activitiy1.Active = true;
            mBF.Activities.Add(activitiy1);

            ActDummy action1 = new ActDummy()
            {
                Description = "Dummy action 1", Active = true
            };

            activitiy1.Acts.Add(action1);
            mGingerRunner.BusinessFlows.Add(mBF);


            //Act
            mGingerRunner.RunBusinessFlow(mBF);

            List <TimeLineEvent> events = mGingerRunnerTimeLine.timeLineEvents.EventList;


            //Assert
            Assert.AreEqual(1, events.Count, "Events count");

            TimeLineEvent businessFlowTimeLineEvent = events[0];

            Assert.IsTrue(businessFlowTimeLineEvent.Start != 0, "Business FlowTimeLine Event.Start !=0");
            Assert.IsTrue(businessFlowTimeLineEvent.End != 0, "Business FlowTimeLine Event.End !=0");
            Assert.AreEqual("BusinessFlow", businessFlowTimeLineEvent.ItemType, "ItemType");

            TimeLineEvent activityTimeLineEvent = businessFlowTimeLineEvent.ChildrenList[0];

            Assert.IsTrue(activityTimeLineEvent.Start != 0, "Activity TimeLine Event.Start !=0");
            Assert.IsTrue(activityTimeLineEvent.End != 0, "Activity TimeLine Event.End !=0");
            Assert.AreEqual("Activity", activityTimeLineEvent.ItemType, "ItemType");

            TimeLineEvent prepActionLineEvent = activityTimeLineEvent.ChildrenList[0];

            Assert.IsTrue(prepActionLineEvent.Start != 0, "PrepAction TimeLine Event.Start !=0");
            Assert.IsTrue(prepActionLineEvent.End != 0, "PrepAction TimeLine Event.End !=0");
            Assert.AreEqual("Prep Action", prepActionLineEvent.ItemType, "ItemType");

            TimeLineEvent actionLineEvent = activityTimeLineEvent.ChildrenList[1];

            Assert.IsTrue(actionLineEvent.Start != 0, "Action TimeLine Event.Start !=0");
            Assert.IsTrue(actionLineEvent.End != 0, "Action TimeLine Event.End !=0");
            Assert.AreEqual("Action", actionLineEvent.ItemType, "ItemType");


            //TODO: add more test that timeline is in boundries of parent
        }