private void tmrStopScript_Tick(object sender, System.EventArgs e)
        {
            GUITestUtility.GUIInfo guiUnit = (GUITestUtility.GUIInfo)seqGUIUT.GUIList[clickNum - 1];
            Control ctrlTested;

            ctrlTested = (Control)GUITestUtility.VerifyField(AUT, guiUnit.GUIControlName);
            resultList.Add(ctrlTested.Text);

            if (clickNum >= seqGUIUT.GUIList.Count)
            {
                tmrRunScript.Enabled  = false;
                tmrStopScript.Enabled = false;
                tmrVerifyTest.Enabled = true;
                try
                {
                    AUT.Dispose();
                }
                catch {}
            }
            else
            {
                tmrRunScript.Enabled  = true;
                tmrStopScript.Enabled = false;
            }
        }
Example #2
0
        private void RunsScript()
        {
            guiTestActionLib = Path.Combine(progDir, "GUITestActionLib.xml");

            GUITestUtility.GUIInfo guiUnit = (GUITestUtility.GUIInfo)seqGUIUT.GUIList[clickNum];

            string        ctrlAction = GUITestUtility.GetAGUIAction(guiTestActionLib, guiUnit.GUIControlType);
            StringBuilder sb         = new StringBuilder(10000);

            try             //chapter 12
            {
                Control ctrlTested = (Control)GUITestUtility.VerifyField(AUT, guiUnit.GUIControlName);
                GUITestActions.GetWindowText((int)ctrlTested.Handle, sb, 10000);
            }
            catch {}

            //object[] paramArr = new object[4];
            object[] paramArr = new object[5];             //chapter 10

            if (ctrlAction == "HandleMenuItems")           //chapter 12
            {
                paramArr[0] = AUT.Handle.ToInt32();
            }
            else
            {
                paramArr[0] = 0;
            }

            paramArr[1] = sb.ToString();
            paramArr[2] = guiUnit.GUIClassName;
            paramArr[3] = guiUnit.GUIParentText;
            paramArr[4] = guiUnit.TextEntry;             //chapter 10

            Type       guiTestLibType = new GUITestActions().GetType();
            object     obj            = Activator.CreateInstance(guiTestLibType);
            MethodInfo mi             = guiTestLibType.GetMethod(ctrlAction);

            //chapter 11
            preChecked = DeterminePreCheckedStatus(guiUnit);

            try
            {
                mi.Invoke(obj, paramArr);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (clickNum < seqGUIUT.GUIList.Count)
            {
                clickNum++;
                tmrRunScript.Enabled  = false;
                tmrStopScript.Enabled = true;
            }
        }
        private bool DeterminePreCheckedStatus(GUITestUtility.GUIInfo guiUnit)
        {
            bool isChecked = false;

            if (guiUnit.GUIControlType == "System.Windows.Form.CheckBox")
            {
                CheckBox chckBx = (CheckBox)GUITestUtility.VerifyField(AUT, guiUnit.GUIControlName);
                isChecked = chckBx.Checked;
            }
            return(isChecked);
        }
        //Chapter 10
        private void AddTextEntryStep(GUITestUtility.GUIInfo guiInfo, GUITestDataCollector GUITDC, ref int GUISeq, TypeVerificationSerializable TypesToVerify)
        {
            if (guiInfo.TextEntry.Length <= 0)
            {
                return;
            }

            GUITestUtility.GUIInfo tempGuiInfo = guiInfo;

            tempGuiInfo.GUIControlType = "HandleTextBoxWithTextEntry";
            GUITestSeqList.GUIList.Add(tempGuiInfo);

            //GUISequence++;
            guiTestVrfy.BuildVerificationList(GUITDC, GUISequence, ref TypesToVerify);
        }
Example #5
0
        private void RunsScript()
        {
            guiTestActionLib = Path.Combine(progDir, "GUITestActionLib.xml");

            GUITestUtility.GUIInfo guiUnit = (GUITestUtility.GUIInfo)seqGUIUT.GUIList[clickNum];

            string ctrlAction = GUITestUtility.GetAGUIAction(guiTestActionLib, guiUnit.GUIControlType);

            StringBuilder sb = new StringBuilder(10000);

            Control ctrlTested = (Control)GUITestUtility.VerifyField(AUT, guiUnit.GUIControlName);

            GUITestActions.GetWindowText((int)ctrlTested.Handle, sb, 10000);

            object[] paramArr = new object[4];
            paramArr[0] = 0;
            paramArr[1] = sb.ToString();            //.Replace("\r\n", "\n");
            paramArr[2] = guiUnit.GUIClassName;
            paramArr[3] = guiUnit.GUIParentText;

            Type       guiTestLibType = new GUITestActions().GetType();
            object     obj            = Activator.CreateInstance(guiTestLibType);
            MethodInfo mi             = guiTestLibType.GetMethod(ctrlAction);

            try
            {
                mi.Invoke(obj, paramArr);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (clickNum < seqGUIUT.GUIList.Count)
            {
                clickNum++;
                tmrRunScript.Enabled  = false;
                tmrStopScript.Enabled = true;
            }
        }
        public void StartGUISurvey()
        {
            GUISortedList = new SortedList();

            int width      = 0;
            int height     = 0;
            int surveyStep = 10;
            int maxLen     = 128;

            GUITestActions.GetWindowSize(HandleUnderSurvey, ref width, ref height);

            for (int xPos = 0; xPos < width; xPos += surveyStep)
            {
                for (int yPos = 0; yPos < width; yPos += surveyStep)
                {
                    GUITestActions.MoveMouseInsideHwnd(HandleUnderSurvey, xPos, yPos, RectPosition.AnySpot);

                    GUITestUtility.GUIInfo GUISurvey = new GUITestUtility.GUIInfo();
                    StringBuilder          winText   = new StringBuilder(GUISurvey.GUIText, maxLen);
                    StringBuilder          clsName   = new StringBuilder(GUISurvey.GUIClassName, maxLen);
                    StringBuilder          pText     = new StringBuilder(GUISurvey.GUIParentText, maxLen);

                    GUITestActions.GetWindowFromPoint(ref GUISurvey.GUIHandle, ref winText, ref clsName, ref pText);

                    GUISurvey.GUIText       = winText.ToString();
                    GUISurvey.GUIClassName  = clsName.ToString();
                    GUISurvey.GUIParentText = pText.ToString();
                    try
                    {
                        GUISortedList.Add(GUISurvey.GUIHandle, GUISurvey);
                    }
                    catch
                    {
                    }
                }
            }

            return;
        }
        private void SetGUIListToTest()
        {
            DataTable dtGUITable = new DataTable();

            MakeDataTableColumn(dtGUITable, "Handle", "System.Int32");
            MakeDataTableColumn(dtGUITable, "Window Text", "System.String");
            MakeDataTableColumn(dtGUITable, "Class Name", "System.String");
            MakeDataTableColumn(dtGUITable, "Parent Text", "System.String");

            for (int i = 0; i < guiSurveyCls.GUISortedList.Count; i++)
            {
                GUITestUtility.GUIInfo gui = (GUITestUtility.GUIInfo)guiSurveyCls.GUISortedList.GetByIndex(i);                // obj;
                DataRow dtRow;
                dtRow                = dtGUITable.NewRow();
                dtRow["Handle"]      = gui.GUIHandle;
                dtRow["Window Text"] = gui.GUIText;
                dtRow["Class Name"]  = gui.GUIClassName;
                dtRow["Parent Text"] = gui.GUIParentText;
                dtGUITable.Rows.Add(dtRow);
            }

            dgAvailableGUIs.DataSource = dtGUITable;
        }