Exemplo n.º 1
0
        private void DisplayAndUpdateResults(DateTime starttime, DateTime endtime)
        {
            List <MsTestRunner.ShortTrxEntity> results = new List <MsTestRunner.ShortTrxEntity>();

            try
            {
                results = MsTestRunner.GetShortResults();
                CurrentTestResultDataGrid.Visibility  = Visibility.Visible;
                CurrentTestResultDataGrid.ItemsSource = results;
                FileNamePresenter.Visibility          = System.Windows.Visibility.Visible;
                string str = ConfigurationManager.AppSettings["TrxFileLocation"];
                FileLink.NavigateUri      = new System.Uri(MsTestRunner.GetLatestResultspath(str));
                FileLink.RequestNavigate += LinkOnRequestNavigate;
                CurrentTestResultDataGrid.HeadersVisibility  = DataGridHeadersVisibility.All;
                CurrentTestResultDataGrid.ColumnHeaderHeight = 30;
                CurrentTestResultDataGrid.BorderThickness    = new Thickness(2);
                MsTestRunner.UpdateResults(ProductNameComboBox.SelectedValue.ToString(), ProductVersionTextBox.Text.Trim(), TestBuildNameTextBox.Text, starttime, endtime);
                System.Threading.Thread.Sleep(5000);
            }
            catch (Exception ex)
            {
                LoggerUtil.LogMessageToFile("Exception caught while getting trx file : " + ex.ToString());
                DisplayErrorMessage("There was some issue while getting the Test Result." + Environment.NewLine + "Either Test Run was cancelled or there was an issue while reading the results file.");
            }
        }
Exemplo n.º 2
0
        private void ShowChart()
        {
            if (RunTestsPage.SelectedProduct != null)
            {
                Hashtable lastRundata = MsTestRunner.GetMyLastRunResults(Environment.MachineName);
                TotalTcTextBlock.Text  = lastRundata["TotalTC"].ToString();
                PassedTcTextBlock.Text = lastRundata["Passed"].ToString();
                FailedTcTextBlock.Text = lastRundata["Failed"].ToString();
                RoiTextBlock.Text      = lastRundata["Roi"].ToString() + " hrs";

                int passed  = Convert.ToInt32(lastRundata["Passed"]);
                int failed  = Convert.ToInt32(lastRundata["Failed"]);
                var myValue = new List <KeyValuePair <string, int> >
                {
                    new KeyValuePair <string, int>("Passed", passed),
                    new KeyValuePair <string, int>("Failed", failed)
                };
                MyPieChart.DataContext = myValue;
            }
            else
            {
                ModernDialog.ShowMessage("Select Product Before proceeding", "Message", MessageBoxButton.OK, null);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Cancels the run by killing MsTest.exe
 /// </summary>
 /// <returns></returns>
 private string CancelRun()
 {
     MsTestRunner.KillMsTest();
     //Process pKill = Process.GetProcesses().Select(x=>x.);
     return("Cancelled");
 }
Exemplo n.º 4
0
        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");
        }