private void SelectCategoryComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectModuleComboBox.Items.Clear(); SelectTestCaseComboBox.Items.Clear(); ClearGrid(); try { Dictionary <string, List <string> > moduleTestCaseDictionary = new Dictionary <string, List <string> >(); if (e.AddedItems.Count > 0) { if (BuildDefinition.Contains(',')) { foreach (string bDef in BuildDefinition.Split(',')) { try { moduleTestCaseDictionary = ProductDetails.GetModuleTestCaseDictionary(bDef, TestDllNameComboBox.SelectedValue.ToString(), SelectCategoryComboBox.SelectedValue.ToString()); } catch { LoggerUtil.LogMessageToFile("Build Definition : " + bDef + " does not contain the Module selected by the user."); } } } else { moduleTestCaseDictionary = ProductDetails.GetModuleTestCaseDictionary(BuildDefinition, TestDllNameComboBox.SelectedValue.ToString(), SelectCategoryComboBox.SelectedValue.ToString()); } var modulelist = moduleTestCaseDictionary.Keys.ToList(); if (modulelist.Count == 0) { throw new Exception("Selected Dll is not a test Dll"); } modulelist.Sort(); foreach (var key in modulelist) { SelectModuleComboBox.Items.Add(key); } } } catch (Exception exception) { DisplayErrorMessage("Loading Modules Failed - " + exception.Message); } finally { //ProgressRing.IsActive = false; } }
private string RunLogic(ref DateTime starttime, ref DateTime endtime) { string dlllocation = null; if (RunParameters.moduleToRun != null) { if (BuildDefinition.Contains(',')) { foreach (string bDef in BuildDefinition.Split(',')) { try { string[] dir = Directory.GetFiles(ConfigurationManager.AppSettings["AppDataLocation"] + "TestBuilds\\" + bDef, "*.dll", SearchOption.AllDirectories); dlllocation = dir.First(x => x.Contains(RunParameters.dllName)); starttime = DateTime.Now; if (RunParameters.product.ToUpper() == "MADE2MANAGE") { MsTestRunner.RunExtended(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } else if (RunParameters.product.ToUpper() == "ROSSAPPS" || RunParameters.product.ToUpper() == "ROSSPLATFORM") { MsTestRunner.RunDirectCall(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } else { MsTestRunner.Run(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } break; } catch (CustomException ex) { throw ex; } catch { LoggerUtil.LogMessageToFile("Build Definition : " + bDef + " does not have the test that was selected."); } } } else { string[] dir = Directory.GetFiles(ConfigurationManager.AppSettings["AppDataLocation"] + "TestBuilds\\" + BuildDefinition, "*.dll", SearchOption.AllDirectories); dlllocation = dir.First(x => x.Contains(RunParameters.dllName)); starttime = DateTime.Now; if (RunParameters.product.ToUpper() == "MADE2MANAGE") { MsTestRunner.RunExtended(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } else if (RunParameters.product.ToUpper() == "ROSSAPPS" || RunParameters.product.ToUpper() == "ROSSPLATFORM") { MsTestRunner.RunDirectCall(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } else { MsTestRunner.Run(RunParameters.dllName, dlllocation, RunParameters.category, RunParameters.moduleToRun, RunParameters.testcase); } } endtime = DateTime.Now; } return("Completed"); }
private void SelectModuleComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ProgressBarDisplay(); ClearGrid(); SelectTestCaseComboBox.Items.Clear(); try { if (e.AddedItems.Count > 0) { var selectedModule = SelectModuleComboBox.SelectedValue.ToString(); Dictionary <string, List <string> > moduleTestCaseDictionary = new Dictionary <string, List <string> >(); if (BuildDefinition.Contains(',')) { foreach (string bDef in BuildDefinition.Split(',')) { try { moduleTestCaseDictionary = ProductDetails.GetModuleTestCaseDictionary(bDef, TestDllNameComboBox.SelectedValue.ToString(), SelectCategoryComboBox.SelectedValue.ToString()); TotalTestCases.Text = moduleTestCaseDictionary[SelectModuleComboBox.SelectedValue.ToString()].Count.ToString(); } catch { LoggerUtil.LogMessageToFile("Build Definition : " + bDef + " does not contain the Module selected by the user."); } } } else { moduleTestCaseDictionary = ProductDetails.GetModuleTestCaseDictionary(BuildDefinition, TestDllNameComboBox.SelectedValue.ToString(), SelectCategoryComboBox.SelectedValue.ToString()); } var testCaselist = moduleTestCaseDictionary[selectedModule]; testCaselist.Sort(); for (int i = 0; i < SelectTestCaseComboBox.Items.Count; i++) { SelectTestCaseComboBox.Items.RemoveAt(i); i--; } SelectTestCaseComboBox.Items.Add("All"); foreach (string testCase in testCaselist) { SelectTestCaseComboBox.Items.Add(testCase); } } } catch (Exception exception) { DisplayErrorMessage("Loading TestCases Failed - " + exception.Message); } finally { InactiveDisplayComponents(); } }