예제 #1
0
        public void APIModelExecutionTest()
        {
            //Arrange
            Activity Activity1 = new Activity();

            Activity1.Active       = true;
            Activity1.ActivityName = "Web API Model";
            Activity1.CurrentAgent = wsAgent;
            mBF.Activities.Add(Activity1);


            ActWebAPIModel actWebAPIModel = new ActWebAPIModel();

            actWebAPIModel.APImodelGUID = Guid.Parse("fcac0742-4747-4939-99ab-2d23c33ab74e");
            actWebAPIModel.APIModelParamsValue.Add(new EnhancedActInputValue()
            {
                Param = "<<COUNTRYNAME>>", Value = "israel", ValueForDriver = "israel"
            });
            actWebAPIModel.Description          = "Testing Action";
            actWebAPIModel.Active               = true;
            actWebAPIModel.EnableRetryMechanism = false;

            mBF.Activities[0].Acts.Add(actWebAPIModel);

            mDriver.StartDriver();

            //Act
            mGR.RunRunner();


            //Assert
            //TODO: add some assert??
        }
예제 #2
0
        public void DragAndDropJS()
        {
            ResetBusinessFlow();

            Activity a1 = new Activity();

            a1.Active            = true;
            a1.TargetApplication = "WebApp";
            mBF.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                LocateBy = eLocateBy.NA, Value = "https://www.w3schools.com/html/html5_draganddrop.asp", Active = true
            };

            a1.Acts.Add(act1);

            ActUIElement act2 = new ActUIElement();

            act2.ElementLocateBy = eLocateBy.ByXPath;
            act2.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='drag1']");
            act2.ElementAction = ActUIElement.eElementAction.DragDrop;
            act2.GetOrCreateInputParam(ActUIElement.Fields.DragDropType, ActUIElement.eElementDragDropType.DragDropJS.ToString());
            act2.TargetLocateBy = eLocateBy.ByXPath;
            act2.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue, "//*[@id='div2']");
            act2.Active = true;
            a1.Acts.Add(act2);

            mGR.RunRunner();
            Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(a1.Status, eRunStatus.Passed);
            Assert.AreEqual(act1.Status, eRunStatus.Passed);
            Assert.AreEqual(act2.Status, eRunStatus.Passed);
        }
예제 #3
0
        public void PluginSay()
        {
            //Arrange
            ResetBusinessFlow();
            WorkSpace.Instance.LocalGingerGrid.NodeList.Clear();

            Activity a1 = new Activity()
            {
                Active = true, TargetApplication = mAppName
            };

            mBusinessFlow.Activities.Add(a1);

            ActPlugIn act1 = new ActPlugIn()
            {
                PluginId = "Memo", ServiceId = "MemoService", ActionId = "Say", Active = true
            };

            act1.AddOrUpdateInputParamValue("text", "hello");
            a1.Acts.Add(act1);

            //Act
            mGingerRunner.RunRunner();
            string outVal = act1.GetReturnValue("I said").Actual;

            //Assert
            Assert.AreEqual("hello", outVal, "outVal=hello");
            Assert.AreEqual(eRunStatus.Passed, mBusinessFlow.RunStatus);
            Assert.AreEqual(eRunStatus.Passed, a1.Status);
        }
예제 #4
0
        public void SimulatedOuputGingerRunnerFlagOn()
        {
            Activity Activity2 = new Activity();

            Activity2.Active       = true;
            Activity2.ActivityName = "Web API REST";
            Activity2.CurrentAgent = wsAgent;
            mBF.Activities.Add(Activity2);

            ActWebAPIRest restAct = new ActWebAPIRest();

            restAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.EndPointURL, "https://jsonplaceholder.typicode.com/posts/1");
            restAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.RequestType, ApplicationAPIUtils.eRequestType.GET.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.ContentType, ApplicationAPIUtils.eContentType.JSon.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.ResponseContentType, ApplicationAPIUtils.eContentType.JSon.ToString());

            restAct.Active = true;
            restAct.EnableRetryMechanism = false;
            restAct.ItemName             = "Web API REST";
            ActReturnValue simulateOutput = new ActReturnValue();

            simulateOutput.Active          = true;
            simulateOutput.Param           = "TestSimulation";
            simulateOutput.SimulatedActual = "TestSimulation";

            mBF.Activities[0].Acts.Add(restAct);
            mGR.RunInSimulationMode = true;

            mDriver.StartDriver();
            mGR.RunRunner();


            if (restAct.ReturnValues.Count > 0)
            {
                foreach (ActReturnValue val in restAct.ReturnValues)
                {
                    if ((val.SimulatedActual != null) && (val.Actual != val.SimulatedActual))
                    {
                        if (val.Actual.ToString() == "OK")
                        {
                            Assert.AreEqual(val.Actual, "OK");
                        }
                    }
                    if ((val.SimulatedActual != null) && (val.Actual == val.SimulatedActual))
                    {
                        Assert.Fail();
                    }
                }
            }
        }
예제 #5
0
 public void OutputValueContainsTest()
 {
     ARC.SimulatedActual = "Test Contains";
     ARC.Expected        = "Test";
     ARC.Operator        = Amdocs.Ginger.Common.Expressions.eOperator.Contains;
     act.ActReturnValues.Add(ARC);
     mGingerRunner.RunRunner();
     Assert.AreEqual(ARC.Status, ActReturnValue.eStatus.Passed);
     Assert.AreEqual(act.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
 }
예제 #6
0
        public void Activity_With_Action_Pass()
        {
            //Arrange
            //string ParamName = "p1";
            //ActGotoURL act1 = new ActGotoURL() { LocateBy = Act.eLocatorType.NA, Value = "https://ginger-automation.github.io/test.html", Active = true };
            //act1.AddOrUpdateReturnParam(ParamName, "378");
            //act1.AddOrUpdateExpectedParam(ParamName, "37");  // failed due to regex

            ////Act
            //mGR.CalculateActionFinalStatus(act1);

            ////Assert
            //// since there is no failure we assume pass
            //Assert.AreEqual(act1.Status, eRunStatus.Fail, "act1.Status=eRunStatus.Fail");
            //ActReturnValue RV = act1.GetReturnValue(ParamName);
            //Assert.AreEqual(RV.Status, ActReturnValue.eStatus.Fail, "RV.Status, ActReturnValue.eStatus.Fail");

            Activity a1 = new Activity();

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

            ActGotoURL act1 = new ActGotoURL()
            {
                LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true
            };

            a1.Acts.Add(act1);

            ActTextBox act2 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "UserName", Value = "Yaron", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act2);

            ActTextBox act3 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "Password", Value = "123456", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act3);


            mGR.RunRunner();


            Assert.AreEqual(a1.Status, eRunStatus.Passed, "a1.Status=eRunStatus.Passed");
        }
예제 #7
0
        //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
        }
        public void Simple_All_Actions_Active()
        {
            //Arrange

            ResetBusinessFlow();

            Activity a1 = new Activity();

            a1.Active            = true;
            a1.TargetApplication = "App1";
            mBF.Activities.Add(a1);

            ActDummy act1 = new ActDummy()
            {
                Description = "A1", Active = true
            };

            a1.Acts.Add(act1);

            ActDummy act2 = new ActDummy()
            {
                Description = "A2", Active = true
            };

            a1.Acts.Add(act2);

            ActDummy act3 = new ActDummy()
            {
                Description = "A3", Active = true
            };

            a1.Acts.Add(act3);


            //Act
            mGR.RunRunner();

            //Assert
            Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(a1.Status, eRunStatus.Passed);
            Assert.AreEqual(act1.Status, eRunStatus.Passed);
            Assert.AreEqual(act2.Status, eRunStatus.Passed);
            Assert.AreEqual(act3.Status, eRunStatus.Passed);
        }
예제 #9
0
        public void PreviousBusinessflowName()
        {
            //Arrange
            ActDummy dummy = new ActDummy();

            dummy.Active = true;
            dummy.Value  = "{FD Object=PreviousBusinessFlow Field=Name}";
            runner.BusinessFlows[1].Activities[0].Acts.Add(dummy);

            //Act
            runner.RunRunner();
            string v = dummy.ValueForDriver;

            //Assert
            Assert.AreEqual(v, "Businessflow1");
        }
예제 #10
0
        public void TestRunsetConfigBFVariables()
        {
            //Arrange
            ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>();
            BusinessFlow BF1 = bfList[0];

            ObservableList <Activity> activityList = BF1.Activities;

            Activity activity = activityList[0];

            ActDummy act1 = new ActDummy()
            {
                Value = "", Active = true
            };

            activity.Acts.Add(act1);

            VariableString v1 = new VariableString()
            {
                Name = "v1", InitialStringValue = "aaa"
            };

            BF1.AddVariable(v1);

            BF1.Active = true;

            mGR.BusinessFlows.Add(BF1);

            //Adding Same Business Flow Again to GingerRunner
            BusinessFlow bfToAdd = (BusinessFlow)BF1.CreateCopy(false);

            bfToAdd.ContainingFolder = BF1.ContainingFolder;
            bfToAdd.Active           = true;
            bfToAdd.Reset();
            bfToAdd.InstanceGuid = Guid.NewGuid();
            mGR.BusinessFlows.Add(bfToAdd);

            WorkSpace.Instance.SolutionRepository = SR;

            //Act
            //Changing initial value of 2nd BF from BusinessFlow Config
            mGR.BusinessFlows[2].Variables[0].Value = "bbb";
            mGR.BusinessFlows[2].Variables[0].DiffrentFromOrigin = true;

            mGR.RunRunner();

            //Assert
            Assert.AreEqual(BF1.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(activity.Status, eRunStatus.Passed);

            Assert.AreEqual(bfToAdd.RunStatus, eRunStatus.Passed);

            Assert.AreEqual(mGR.BusinessFlows[1].Variables[0].Value, "aaa");
            Assert.AreEqual(mGR.BusinessFlows[2].Variables[0].Value, "bbb");
        }
예제 #11
0
        public void WebServices_WebAPIRest()
        {
            WebServicesDriver mDriver = new WebServicesDriver(mBF);

            Agent wsAgent = new Agent();

            wsAgent.DriverType = Agent.eDriverType.WebServices;
            wsAgent.Driver     = mDriver;
            ApplicationAgent mAG = new ApplicationAgent();

            mAG.Agent = wsAgent;

            mGR = new GingerRunner();
            mGR.SolutionAgents = new ObservableList <Agent>();
            mGR.SolutionAgents.Add(wsAgent);

            mGR.BusinessFlows.Add(mBF);

            Activity Activity2 = new Activity();

            Activity2.Active       = true;
            Activity2.ActivityName = "Web API REST";
            Activity2.CurrentAgent = wsAgent;
            mBF.Activities.Add(Activity2);

            ActWebAPIRest restAct = new ActWebAPIRest();

            restAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.EndPointURL, "https://jsonplaceholder.typicode.com/posts/1");
            restAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.RequestType, ApplicationAPIUtils.eRequestType.GET.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.ContentType, ApplicationAPIUtils.eContentType.JSon.ToString());
            restAct.AddOrUpdateInputParamValue(ActWebAPIRest.Fields.ResponseContentType, ApplicationAPIUtils.eContentType.JSon.ToString());

            restAct.Active = true;
            restAct.EnableRetryMechanism = false;
            restAct.ItemName             = "Web API REST";

            mBF.Activities[0].Acts.Add(restAct);

            mDriver.StartDriver();
            mGR.RunRunner();


            if (restAct.ReturnValues.Count > 0)
            {
                foreach (ActReturnValue val in restAct.ReturnValues)
                {
                    if (val.Actual.ToString() == "OK")
                    {
                        Assert.AreEqual(val.Actual, "OK");
                    }
                }
            }
        }
예제 #12
0
 private void RunFlow(BusinessFlow businessFlow)
 {
     // We lock Ginger runner so we will not run 2 flows at the same time on same GR
     lock (mGingerRunner)
     {
         mGingerRunner.BusinessFlows.Clear();
         mGingerRunner.BusinessFlows.Add(businessFlow);
         mGingerRunner.CurrentBusinessFlow = businessFlow;
         mGingerRunner.RunRunner();
     }
 }
        public void DragAndDropSelenium()
        {
            // Arrange
            ResetBusinessFlow();

            Activity a1 = new Activity();

            a1.Active            = true;
            a1.TargetApplication = "WebApp";
            mBF.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                LocateBy = eLocateBy.NA, Value = "https://demos.telerik.com/kendo-ui/dragdrop/index", Active = true
            };

            a1.Acts.Add(act1);


            ActUIElement act3 = new ActUIElement();

            act3.ElementLocateBy = eLocateBy.ByXPath;
            // act2.LocateValue
            act3.GetOrCreateInputParam(ActUIElement.Fields.ElementLocateValue, "//*[@id='draggable']");
            act3.ElementAction = ActUIElement.eElementAction.DragDrop;
            act3.GetOrCreateInputParam(ActUIElement.Fields.DragDropType, ActUIElement.eElementDragDropType.DragDropSelenium.ToString());
            act3.TargetLocateBy = eLocateBy.ByXPath;
            act3.GetOrCreateInputParam(ActUIElement.Fields.TargetLocateValue, "//*[@id='droptarget']");
            act3.Active = true;
            a1.Acts.Add(act3);

            // Act
            mGR.RunRunner();

            //Assert
            Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(a1.Status, eRunStatus.Passed);
            Assert.AreEqual(act1.Status, eRunStatus.Passed);
            Assert.AreEqual(act3.Status, eRunStatus.Passed);
        }
예제 #14
0
        public void PluginSay()
        {
            mTestHelper.Log("test PluginSay");

            lock (mBusinessFlow)
            {
                //Arrange
                ResetBusinessFlow();

                Activity a1 = new Activity()
                {
                    Active = true, TargetApplication = mAppName
                };
                mBusinessFlow.Activities.Add(a1);

                ActPlugIn act1 = new ActPlugIn()
                {
                    PluginId = "Memo", ServiceId = "SpeechService", ActionId = "Say", Active = true, AddNewReturnParams = true
                };
                act1.AddOrUpdateInputParamValue("text", "hello");
                a1.Acts.Add(act1);

                //Act
                mTestHelper.Log("Before Ginger Runner");
                mGingerRunner.RunRunner();
                // mGingerRunner.CloseAgents();
                mTestHelper.Log("After Ginger Runner");

                //Assert
                Assert.AreEqual(eRunStatus.Passed, act1.Status);
                Assert.AreEqual(eRunStatus.Passed, a1.Status);
                Assert.AreEqual(eRunStatus.Passed, mBusinessFlow.RunStatus);
                string outVal = act1.GetReturnValue("I said").Actual;
                Assert.AreEqual("hello", outVal, "outVal=hello");
            }
        }
예제 #15
0
        public void TestVariable_StringSetValue()
        {
            //Arrange
            string initialValue = "123";
            string variableName = "V1";
            string newValue     = "abc";

            ResetBusinessFlow();

            Activity activity1 = new Activity()
            {
                Active = true
            };

            mBF.Activities.Add(activity1);

            VariableString v1 = new VariableString()
            {
                Name = variableName, InitialStringValue = initialValue
            };

            activity1.AddVariable(v1);

            ActSetVariableValue actSetVariableValue = new ActSetVariableValue()
            {
                VariableName = variableName, SetVariableValueOption = VariableBase.eSetValueOptions.SetValue, Value = newValue, Active = true
            };

            activity1.Acts.Add(actSetVariableValue);

            //Act
            mGR.RunRunner();

            //Assert

            Assert.AreEqual(eRunStatus.Passed, actSetVariableValue.Status);
            Assert.AreEqual(eRunStatus.Passed, mBF.RunStatus);
            Assert.AreEqual(eRunStatus.Passed, activity1.Status);
            Assert.AreEqual(newValue, v1.Value);
        }
        private void RunFlow(BusinessFlow businessFlow)
        {
            GingerRunner           gingerRunner = new GingerRunner();
            ExecutionLoggerManager ex           = (ExecutionLoggerManager)gingerRunner.RunListeners[0]; // temp until we remove it from GR constructor and add manually


            //!!!!!!!!!!!

            ex.ExecutionLogfolder = @"c:\temp\jj";   // !!!!!!!!!!!!!!!!!
            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(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("----------------------------");
        }
 private void Run()
 {
     mGR.BusinessFlows[0].Reset();
     mGR.RunRunner();
 }
예제 #18
0
        public void SCM_Login()
        {
            //Arrange

            ResetBusinessFlow();

            // mGR.SetSpeed(1);

            Activity a1 = new Activity();

            a1.Active            = true;
            a1.TargetApplication = "SCM";
            mBF.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                LocateBy = eLocateBy.NA, Value = "https://ginger-automation.github.io/test.html", Active = true
            };

            a1.Acts.Add(act1);

            ActTextBox act2 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "UserName", Value = "Yaron", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act2);

            ActTextBox act3 = new ActTextBox()
            {
                LocateBy = eLocateBy.ByID, LocateValue = "Password", Value = "123456", TextBoxAction = ActTextBox.eTextBoxAction.SetValue, Active = true
            };

            a1.Acts.Add(act3);

            ActSubmit act4 = new ActSubmit()
            {
                LocateBy = eLocateBy.ByValue, LocateValue = "Log in", Active = true
            };

            a1.Acts.Add(act4);

            VariableString v1 = (VariableString)mBF.GetVariable("v1");

            v1.Value = "123";

            //Act
            mGR.RunRunner();
            // mGR.CurrentBusinessFlow = mBF;
            // mGR.RunActivity(a1);

            //Assert
            Assert.AreEqual(mBF.RunStatus, eRunStatus.Passed);
            Assert.AreEqual(a1.Status, eRunStatus.Passed);
            Assert.AreEqual(act1.Status, eRunStatus.Passed);
            Assert.AreEqual(act2.Status, eRunStatus.Passed);
            Assert.AreEqual(act3.Status, eRunStatus.Passed);
            Assert.AreEqual(act4.Status, eRunStatus.Passed);

            Assert.AreEqual(v1.Value, "123");
        }