public void CheckFeaturesExpectedResult() { this.treeName = "tVFeatures"; #region Variable Declarations WinComboBox uICBConversationsComboBox = this.UIONVIFClientTestToolWindow.UICBConversationsWindow.UICBConversationsComboBox; WinEdit uITBOutputEdit = this.UIONVIFClientTestToolWindow.UITBOutputWindow.UITBOutputEdit; WinTree uITVTestCasesTree = this.UIONVIFClientTestToolWindow.UITVTestCasesWindow.UITVTestCasesTree; WinTabPage uIFeaturesTabPage = this.UIONVIFClientTestToolWindow.UITCModesWindow.UIFeaturesTabPage; WinList uILVStepsList = this.UIONVIFClientTestToolWindow.UILVStepsWindow.UILVStepsList; #endregion if (test.featuresExpectedResult != null) { // Щелкните "Features" вкладка uIFeaturesTabPage.WaitForControlReady(); Mouse.Click(uIFeaturesTabPage); foreach (var featureExpectedResult in test.featuresExpectedResult) { mTree0 = featureExpectedResult.Key; this.mTreeItem = this.UIONVIFClientTestToolWindow.UITVTestCasesWindow.UIProfileSTestCasesTreeItem; //this.mTreeItem.(); mTreeItem.WaitForControlReady(); Mouse.Click(this.mTreeItem, new Point(0, 0)); Mouse.Hover(this.mTreeItem, new Point(this.mTreeItem.Width / 2, this.mTreeItem.Height / 2)); LogData logDataFeature = new LogData(); logDataFeature.testPath = testPath; logDataFeature.currentResult = featureExpectedResult.Key + " " + this.mTreeItem.ToolTipText; logDataFeature.expectedResult = featureExpectedResult.Key + " " + featureExpectedResult.Value; if (logDataFeature.currentResult == logDataFeature.expectedResult) { logDataFeature.result = "PASSED"; } else { logDataFeature.result = "FAILED"; } this.logDataFeatures.Add(logDataFeature); } } }
public void Login(string usernameParam, string passwordParam) { // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. // Find Dynamics AX Window WinWindow dynamicsAXWindow = new WinWindow(); dynamicsAXWindow.TechnologyName = "MSAA"; dynamicsAXWindow.SearchProperties.Add("Name", "Microsoft Dynamics AX", PropertyExpressionOperator.Contains); dynamicsAXWindow.SearchProperties.Add("ClassName", "AxMainFrame"); dynamicsAXWindow.WaitForControlExist(); mUIAXCWindow = dynamicsAXWindow; WinTabPage uITabPage = new WinTabPage(mUIAXCWindow); uITabPage.TechnologyName = "MSAA"; uITabPage.SearchProperties.Add("ControlType", "TabPage"); uITabPage.SearchProperties.Add("Name", "Home"); uITabPage.WaitForControlReady(); mUITabPage = uITabPage; mUITabPage.WaitForControlReady(); Mouse.Click(uITabPage, new Point(uITabPage.Width / 2, mUITabPage.Height / 2)); }
/// <summary> /// RunConformanceTest /// </summary> public void RunConformanceTest() { #region Variable Declarations WinTabPage uIDiagnosticsTabPage = this.UIONVIFClientTestToolWindow.UITCMainWindow.UIDiagnosticsTabPage; //WinButton uIRunConformanceTestButton = this.UIONVIFClientTestToolWindow.UIRunConformanceTestWindow.UIRunConformanceTestButton; WinButton uIRunConformanceTestButton = this.UIONVIFClientTestToolWindow.UIM_ToolStripToolBar.UIRunConformanceTestButton; WinWindow uIОКWindow = this.UIWarningWindow.UIОКWindow; WinList uILVUnitsList = this.UIONVIFClientTestToolWindow.UILVUnitsWindow.UILVUnitsList; #endregion string stepName = ""; try { stepName = "GetFeaturesList"; foreach (DeviceExpectedResult device in this.test.expectedResults) { this.mac = device.deviceMAC; foreach (WinCheckBox listItem in uILVUnitsList.Items) { if (listItem.AccessibleDescription.Contains(device.deviceMAC)) { string name = listItem.AccessibleDescription.Substring(listItem.AccessibleDescription.IndexOf("Name: ") + 6, listItem.AccessibleDescription.IndexOf("; MAC", 11) - 12); this.macAndDevice.Add(this.mac, name); break; } } } WinTabPage uIConformanceTabPage = this.UIONVIFClientTestToolWindow.UITCMainWindow.UIConformanceTabPage; WinEdit uITBProductNameEdit = this.UIONVIFClientTestToolWindow.UITBProductNameWindow.UITBProductNameEdit; stepName = "OpenConformanceTab"; uIConformanceTabPage.WaitForControlReady(); Mouse.Click(uIConformanceTabPage); stepName = "GetClientName"; uITBProductNameEdit.WaitForControlReady(); this.macAndDevice.Add("deviceName", uITBProductNameEdit.Text); // Щелкните "Diagnostics" вкладка stepName = "OpenDiagnosticsTab"; uIDiagnosticsTabPage.WaitForControlReady(10000); Mouse.Click(uIDiagnosticsTabPage); // Щелкните "Run Conformance Test" кнопка stepName = "RunConformance"; uIRunConformanceTestButton.WaitForControlReady(10000); Mouse.Click(uIRunConformanceTestButton); stepName = "CheckFeaturesWarningWindow"; if (uIОКWindow.Exists) { WinButton uIОКButton = this.UIWarningWindow.UIОКWindow.UIОКButton; // Щелкните "ОК" кнопка uIОКButton.WaitForControlReady(); Mouse.Click(uIОКButton); } stepName = "WaitingDone"; WinText text = this.UIONVIFClientTestToolWindow.UISSMainStatusBar.UIItemText; System.Threading.Thread.Sleep(1000); stepName = "WaitingDone2"; text.WaitForControlExist(5000); stepName = "WaitingDone3"; System.Threading.Thread.Sleep(1000); text.WaitForControlCondition(IsStatusDone, 2700000); stepName = "WaitingDone4"; } catch (Exception e) { throw new Exception(String.Format("Substep Name {0}. /n Message: {1}", stepName, e.Message), e); } }
public void CheckExpectedResult() { this.treeName = "tVTestCases"; #region Variable Declarations WinComboBox uICBConversationsComboBox = this.UIONVIFClientTestToolWindow.UICBConversationsWindow.UICBConversationsComboBox; WinEdit uITBOutputEdit = this.UIONVIFClientTestToolWindow.UITBOutputWindow.UITBOutputEdit; WinTree uITVTestCasesTree = this.UIONVIFClientTestToolWindow.UITVTestCasesWindow.UITVTestCasesTree; WinTabPage uITestDetailsTabPage = this.UIONVIFClientTestToolWindow.UITCLogWindow.UITestDetailsTabPage; WinList uILVStepsList = this.UIONVIFClientTestToolWindow.UILVStepsWindow.UILVStepsList; #endregion if (test.expectedResults != null) { // Щелкните "Test Details" вкладка uITestDetailsTabPage.WaitForControlReady(); Mouse.Click(uITestDetailsTabPage); foreach (DeviceExpectedResult device in test.expectedResults) { this.mac = device.deviceMAC; foreach (ExpectedResult result in device.expectedResults) { foreach (string s in result.expectedResult.Keys) { mTree0 = result.parentNode0; mTree1 = result.parentNode1; mTree2 = s; this.mTreeItem = this.UIONVIFClientTestToolWindow.UITVTestCasesWindow.UIProfileSTestCasesTreeItem.UIMediaProfileConfigurTreeItem.UIMEDIAPROFILECONFIGURTreeItem1; bool currentResultNotStarted = false; // Щелкните по элементу дерева this.mTreeItem.WaitForControlExist(); Mouse.Click(this.mTreeItem); LogData logData = new LogData(); if (uICBConversationsComboBox.Items.Count != 0) { // выбрать элемент в списке устройств uICBConversationsComboBox.SelectedItem = this.macAndDevice["deviceName"] + " - " + this.macAndDevice[this.mac]; foreach (WinListItem item in uILVStepsList.Items) { TestStep testStep = new TestStep(); testStep.results = item.AccessibleDescription; logData.testSteps.Add(testStep); } } else { currentResultNotStarted = true; } if (currentResultNotStarted) { logData.currentResult = s + " NOT STARTED"; } else { if (logData.testSteps.Count == 0) { logData.currentResult = s + " NOT DETECTED"; } else { if (logData.testSteps.FindAll(C => C.results.Contains("NOT DETECTED")).Count != 0) { logData.currentResult = s + " NOT DETECTED"; } else { if (logData.testSteps.FindAll(C => C.results.Contains("FAILED")).Count != 0) { logData.currentResult = s + " FAILED"; } else { logData.currentResult = s + " PASSED"; } } } } logData.expectedResult = s + " " + result.expectedResult[s]; if (logData.currentResult == logData.expectedResult) { logData.result = "PASSED"; } else { logData.result = "FAILED"; } logData.testPath = this.testPath; logData.deviceMAC = this.mac; this.logData.Add(logData); } } } } }
/// <summary> /// CheckProfiles - Используйте "CheckProfilesParams" для передачи параметров в этот метод. /// </summary> public void CheckProfiles() { #region Variable Declarations WinTabPage uIConformanceTabPage = this.UIONVIFClientTestToolWindow.UITCMainWindow.UIConformanceTabPage; #endregion if (test.profilesExpectedResult != null) { // Щелкните "Conformance" вкладка uIConformanceTabPage.WaitForControlReady(); Mouse.Click(uIConformanceTabPage); WinCheckBox uIProfileSwitherrataCheckBox = this.UIONVIFClientTestToolWindow.UIProfilesWindow.UIProfileSwitherrataCheckBox; WinCheckBox uIProfileGwitherrataCheckBox = this.UIONVIFClientTestToolWindow.UIProfilesWindow.UIProfileGwitherrataCheckBox; WinCheckBox uIProfileCCheckBox = this.UIONVIFClientTestToolWindow.UIProfilesWindow.UIProfileCCheckBox; WinCheckBox uIProfileQCheckBox = this.UIONVIFClientTestToolWindow.UIProfilesWindow.UIProfileQCheckBox; WinCheckBox uIProfileACheckBox = this.UIONVIFClientTestToolWindow.UIProfilesWindow.UIProfileACheckBox; foreach (var profileExpectedResult in test.profilesExpectedResult) { LogData logDataProfile = new LogData(); logDataProfile.testPath = testPath; logDataProfile.expectedResult = profileExpectedResult.Key + " " + profileExpectedResult.Value; switch (profileExpectedResult.Key) { case "Profile S": { if (uIProfileSwitherrataCheckBox.Enabled) { logDataProfile.currentResult = "Profile S NOT SUPPORTED"; } else { if (uIProfileSwitherrataCheckBox.Checked) { logDataProfile.currentResult = "Profile S SUPPORTED"; } else { logDataProfile.currentResult = "Profile S NOT SUPPORTED"; } } break; } case "Profile G": { if (uIProfileGwitherrataCheckBox.Enabled) { logDataProfile.currentResult = "Profile G NOT SUPPORTED"; } else { if (uIProfileGwitherrataCheckBox.Checked) { logDataProfile.currentResult = "Profile G SUPPORTED"; } else { logDataProfile.currentResult = "Profile G NOT SUPPORTED"; } } break; } case "Profile C": { if (uIProfileCCheckBox.Enabled) { logDataProfile.currentResult = "Profile C NOT SUPPORTED"; } else { if (uIProfileCCheckBox.Checked) { logDataProfile.currentResult = "Profile C SUPPORTED"; } else { logDataProfile.currentResult = "Profile C NOT SUPPORTED"; } } break; } case "Profile Q": { if (uIProfileQCheckBox.Enabled) { logDataProfile.currentResult = "Profile Q NOT SUPPORTED"; } else { if (uIProfileQCheckBox.Checked) { logDataProfile.currentResult = "Profile Q SUPPORTED"; } else { logDataProfile.currentResult = "Profile Q NOT SUPPORTED"; } } break; } case "Profile A": { if (uIProfileACheckBox.Enabled) { logDataProfile.currentResult = "Profile A NOT SUPPORTED"; } else { if (uIProfileACheckBox.Checked) { logDataProfile.currentResult = "Profile A SUPPORTED"; } else { logDataProfile.currentResult = "Profile A NOT SUPPORTED"; } } break; } } if (logDataProfile.currentResult == logDataProfile.expectedResult) { logDataProfile.result = "PASSED"; } else { logDataProfile.result = "FAILED"; } this.logDataProfiles.Add(logDataProfile); } } }