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; } }
//chapter 8 private void AddTestVerification() { if (AUT == null) { return; } string VerifyDataStore = guiTestDataStore.Replace(".xml", "_verify.xml"); TypeVerificationSerializable verifyTypes = new TypeVerificationSerializable(); object obj = (object)verifyTypes; GUITestUtility.DeSerializeInfo(VerifyDataStore, ref obj); verifyTypes = (TypeVerificationSerializable)obj; TypeVerification oneType = (TypeVerification)verifyTypes.TypeList[clickNum - 1]; object resulted = null; foreach (TestExpectation fieldName in oneType.MemberList) { TestExpectation tested = fieldName; try { resulted = GUITestUtility.VerifyField(AUT, tested.VerifyingMember); tested.isField = true; } catch (Exception ex4) { resulted = GUITestUtility.VerifyProperty(AUT, tested.VerifyingMember); tested.isProperty = true; } VerifyAlphanumericResult(ref tested, resulted); VerifyClipboard(ref tested, resulted); } }
public void BuildVerificationList(GUITestDataCollector guiTDC, int guiSeq, ref TypeVerificationSerializable TypesToVerify) { TypesToVerify.AUTPath = AUT; TypesToVerify.AUTStartupForm = StartForm; TypeVerification typeVerify = new TypeVerification(); GetSelectedMembers(guiTDC, guiSeq, ref typeVerify); TypesToVerify.TypeList.Add(typeVerify); }
//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); }