private void btnStartGUITest_Click(object sender, System.EventArgs e)
        {
            TypesToVerify = new TypeVerificationSerializable();
            GUISequence   = 0;          //added for chapter 8

            GUITestSeqList = new GUITestUtility.GUIInfoSerializable();

            opnAUT.Title  = "Specify an Application Under Test";
            opnAUT.Filter = "GUI Applications(*.EXE; *.DLL)|*.EXE;*.DLL|All files (*.*)|*.*";
            if (opnAUT.ShowDialog() == DialogResult.OK)
            {
                applicationUT          = opnAUT.FileName;
                GUITestSeqList.AUTPath = applicationUT;

                GetTypeToTestFromAUT();
                try
                {
                    formUT = (Form)GUITestUtility.StartAUT(applicationUT, startupForm);
                }
                catch (InvalidCastException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                return;
            }
        }
        private void StartAUT()
        {
            seqGUIUT = new GUITestUtility.GUIInfoSerializable();
            object obj = (object)seqGUIUT;

            GUITestUtility.DeSerializeInfo(guiTestDataStore, ref obj);
            seqGUIUT = (GUITestUtility.GUIInfoSerializable)obj;

            string AUTPath     = seqGUIUT.AUTPath;
            string startupType = seqGUIUT.AUTStartupForm;

            if (AUT == null)
            {
                AUT = (Form)GUITestUtility.StartAUT(AUTPath, startupType);
            }

            int           hwnd      = (int)AUT.Handle;
            StringBuilder sbClsName = new StringBuilder(128);

            GUITestActions.GetClassName(hwnd, sbClsName, 128);
            string clsName = sbClsName.ToString();
            string winText = AUT.Text;
            string pText   = "";

            GUITestActions.SynchronizeWindow(ref hwnd, ref winText, ref clsName, ref pText);
        }
예제 #3
0
        private void btnStartApp_Click(object sender, System.EventArgs e)
        {
            string AppUT  = @"C:\GUISourceCode\Chapter03\CSharpAPITextViewer\bin\Debug\CSharpAPITextViewer.exe";
            string TypeUT = "CSharpAPITextViewer.Form1";

            AUTobj = GUITestUtility.StartAUT(AppUT, TypeUT);
        }
예제 #4
0
        private void StartAUT()
        {
            seqGUIUT = new GUITestUtility.GUIInfoSerializable();
            object obj = (object)seqGUIUT;

            GUITestUtility.DeSerializeInfo(guiTestDataStore, ref obj);
            seqGUIUT = (GUITestUtility.GUIInfoSerializable)obj;

            string AUTPath     = seqGUIUT.AUTPath;
            string startupType = seqGUIUT.AUTStartupForm;

            int hwnd = 0;

            if (AUT == null)
            {
                try                 //chapter 13
                {
                    AUT  = (Form)GUITestUtility.StartAUT(AUTPath, startupType);
                    hwnd = (int)AUT.Handle;
                }
                catch (InvalidCastException ex)                 //chapter 13
                {
                    AUT = GUITestUtility.StartControlUT(AUTPath, startupType);
                    AUT.Show();
                    Control ctrlAUT = AUT.Controls[0];
                    hwnd = (int)ctrlAUT.Handle;
                }
            }

            //int hwnd = (int)AUT.Handle;

            StringBuilder sbClsName = new StringBuilder(128);

            GUITestActions.GetClassName(hwnd, sbClsName, 128);
            string clsName = sbClsName.ToString();
            string winText = AUT.Text;
            string pText   = "";

            GUITestActions.SynchronizeWindow(ref hwnd, ref winText, ref clsName, ref pText);
        }