TypeVerificationSerializable TypesToVerify; // = new TypeVerificationSerializable(); private void dgAvailableGUIs_DoubleClick(object sender, System.EventArgs e) { GUITDC = new GUITestDataCollector(); GUITDC.guiInfo = (GUITestUtility.GUIInfo)guiSurveyCls.GUISortedList.GetByIndex(dgAvailableGUIs.CurrentCell.RowNumber); TempList = new ArrayList(); GUITDC.guiInfo.GUIControlName = PopulateGUINameTypeLists((Control)formUT, GUITDC.guiInfo.GUIHandle, true); TempList.Sort(); GUITDC.ControlNameList = TempList; TempList = new ArrayList(); GUITDC.guiInfo.GUIControlType = PopulateGUINameTypeLists((Control)formUT, GUITDC.guiInfo.GUIHandle, false); TempList.Sort(); GUITDC.controlTypeList = TempList; GUITDC.PopulateGUIInfo(); //chapter 8 GUITDC.startupForm = startupForm; //for simple verification guiTestVrfy = new GUITestVerification(applicationUT, startupForm, GUITDC.guiInfo.GUIControlName); guiTestVrfy.FindMembersToVerify(applicationUT, GUITDC); //chapter 7 if (GUITDC.ShowDialog() == DialogResult.OK) { GUITDC.guiInfo.GUIMemberType = GetMemberType(GUITDC.guiInfo.GUIControlName); GUITestSeqList.GUIList.Add(GUITDC.guiInfo); //chapter 8 GUISequence++; guiTestVrfy.BuildVerificationList(GUITDC, GUISequence, ref TypesToVerify); } }
private void GetSelectedMembers(GUITestDataCollector guiTDC, int guiSeq, ref TypeVerification typeVerify) { int itemCounter = 0; string typeMember = ""; string[] expectedItems = GetExpectedOutcome(guiTDC.txtExpectedResult); for (int i = 0; i < guiTDC.chckLstMembersToVerify.Items.Count; i++) { if (guiTDC.chckLstMembersToVerify.GetItemChecked(i)) { typeMember = guiTDC.chckLstMembersToVerify.GetItemText(guiTDC.chckLstMembersToVerify.Items[i]); if (!typeMember.StartsWith("\t")) { typeVerify.TypeName = typeMember; typeVerify.GUIEvent = GUIEvent; } else { TestExpectation individualTest = new TestExpectation(); individualTest.EventMember = GUIEvent; individualTest.VerifyingMember = typeMember.Trim(); individualTest.ExpectingResult = expectedItems[itemCounter]; individualTest.GUIActionSequence = guiSeq; itemCounter++; typeVerify.MemberList.Add(individualTest); } } } }
public void FindMembersToVerify(string AUT, GUITestDataCollector guiTDC) { if (AUT == null) { return; } Assembly asm = Assembly.LoadFrom(AUT); Type[] types = asm.GetTypes(); BindingFlags allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance; foreach (Type typ in types) { if (typ.Namespace + "." + typ.Name == StartForm) { guiTDC.chckLstMembersToVerify.Items.Add(typ.Namespace + "." + typ.Name); foreach (FieldInfo fld in typ.GetFields(allFlags)) { guiTDC.chckLstMembersToVerify.Items.Add("\t" + fld.Name); } foreach (PropertyInfo prpty in typ.GetProperties(allFlags)) { guiTDC.chckLstMembersToVerify.Items.Add("\t" + prpty.Name); } } } }
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); }
private void dgAvailableGUIs_DoubleClick(object sender, System.EventArgs e) { GUITDC = new GUITestDataCollector(); GUITDC.guiInfo = (GUITestUtility.GUIInfo)guiSurveyCls.GUISortedList.GetByIndex(dgAvailableGUIs.CurrentCell.RowNumber); TempList = new ArrayList(); GUITDC.guiInfo.GUIControlName = PopulateGUINameTypeLists((Control)formUT, GUITDC.guiInfo.GUIHandle, true); TempList.Sort(); GUITDC.ControlNameList = TempList; TempList = new ArrayList(); GUITDC.guiInfo.GUIControlType = PopulateGUINameTypeLists((Control)formUT, GUITDC.guiInfo.GUIHandle, false); TempList.Sort(); GUITDC.controlTypeList = TempList; GUITDC.PopulateGUIInfo(); if (GUITDC.ShowDialog() == DialogResult.OK) { GUITDC.guiInfo.GUIMemberType = GetMemberType(GUITDC.guiInfo.GUIControlName); GUITestSeqList.GUIList.Add(GUITDC.guiInfo); } }