Пример #1
0
        private void testRunWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            testRunWorker.ReportProgress(100 * (testsToRunStartCount - testsToRun.Count) / (testsToRunStartCount + 1));

            NunitManager.RunTestCase(currentTest);

            testRunWorker.ReportProgress(100 * (testsToRunStartCount - testsToRun.Count + 1) / (testsToRunStartCount + 1));
        }
Пример #2
0
 private void testListWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     try
     {
         loadedTestCases = NunitManager.StartRunner(currentlyLoadingProject.AssemblyPath);
     }
     catch (Exception ex)
     {
         Trace.TraceError("Error loading test cases for project " + currentlyLoadingProject.Name + ": " + ex.ToString());
     }
 }
Пример #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.Columns[e.ColumnIndex].Name == "Debug")
            {
                if (currentTest == null)
                {
                    statusButton.Image = emptyIcon;
                    statusLabel.Text   = "";

                    DataRow dataRow = ((DataRowView)dataGridView1.CurrentRow.DataBoundItem).Row;
                    currentTest = (TestInformation)dataRow["TestInformation"];

                    currentTest.TestState         = TestState.None;
                    currentTest.FailureMessage    = "";
                    currentTest.FailureStackTrace = "";
                    currentTest.Time   = TimeSpan.Zero;
                    dataRow["Success"] = currentTest.TestState;
                    dataRow["Time"]    = "";
                    dataRow["Message"] = currentTest.FailureMessage;

                    currentTest.Debug    = true;
                    testsToRunStartCount = 1;
                    runTestsButton.Text  = "Stop";
                    runTestsButton.Image = stopIcon;
                    NunitManager.PreRunTestCase(currentTest);
                    testRunWorker.RunWorkerAsync();
                }
            }
            if (dataGridView1.Columns[e.ColumnIndex].Name == "Stacktrace")
            {
                TestDetailsForm testDetailsForm = new TestDetailsForm();
                DataRow         row             = ((DataRowView)dataGridView1.CurrentRow.DataBoundItem).Row;
                TestInformation testInformation = (TestInformation)row["TestInformation"];
                testDetailsForm.SetTestInformation(testInformation);
                testDetailsForm.ShowDialog();
            }
        }
Пример #4
0
 public int UpdateSolution_Begin(ref int pfCancelUpdate)
 {
     NunitManager.StopRunners();
     return(VSConstants.S_OK);
 }
Пример #5
0
        private void testRunWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            NunitManager.PostRunTestCase(currentTest);

            {
                DataRow dataRow = currentTest.DataRow;
                dataRow["Success"] = currentTest.TestState;
                dataRow["Time"]    = currentTest.Time.TotalSeconds.ToString();
                dataRow["Message"] = currentTest.FailureMessage;
            }

            if (testsToRun.Count > 0)
            {
                currentTest = testsToRun.Dequeue();
                NunitManager.PreRunTestCase(currentTest);
                testRunWorker.RunWorkerAsync();
            }
            else
            {
                currentTest          = null;
                runTestsButton.Text  = "Run";
                runTestsButton.Image = runIcon;

                int successes = 0;
                int failures  = 0;
                int aborts    = 0;
                int unknowns  = 0;
                int total     = dataGridView1.Rows.Count;

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    DataRow   dataRow   = ((DataRowView)row.DataBoundItem).Row;
                    TestState testState = (TestState)dataRow["Success"];
                    if (TestState.Success.Equals(testState))
                    {
                        successes++;
                    }
                    else if (TestState.Failure.Equals(testState))
                    {
                        failures++;
                    }
                    else if (TestState.Aborted.Equals(testState))
                    {
                        aborts++;
                    }
                    else
                    {
                        unknowns++;
                    }
                }

                statusButton.Image = emptyIcon;
                if (successes == total)
                {
                    statusButton.Image = successIcon;
                }
                if (failures != 0)
                {
                    statusButton.Image = failureIcon;
                }

                statusLabel.Text = "Total tests run: " + (successes + failures) + " Failures: " + failures + " " + (successes + failures != 0?"(" + (100 * failures / (successes + failures)) + "%)":"");
            }
        }
Пример #6
0
        private void runTests_Click(object sender, EventArgs e)
        {
            if (currentTest == null)
            {
                statusButton.Image = emptyIcon;
                statusLabel.Text   = "";

                if (dataGridView1.SelectedRows.Count == 0)
                {
                    foreach (DataGridViewRow row in dataGridView1.Rows)
                    {
                        DataRow         dataRow         = ((DataRowView)row.DataBoundItem).Row;
                        TestInformation testInformation = (TestInformation)dataRow["TestInformation"];
                        testInformation.Debug = false;

                        testInformation.TestState         = TestState.None;
                        testInformation.FailureMessage    = "";
                        testInformation.FailureStackTrace = "";
                        testInformation.Time = TimeSpan.Zero;
                        dataRow["Success"]   = testInformation.TestState;
                        dataRow["Time"]      = "";
                        dataRow["Message"]   = testInformation.FailureMessage;

                        testsToRun.Enqueue(testInformation);
                    }
                }
                else
                {
                    List <DataRow> dataRows = new List <DataRow>();
                    foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                    {
                        dataRows.Add(((DataRowView)row.DataBoundItem).Row);
                    }
                    dataRows.Reverse();
                    foreach (DataRow dataRow in dataRows)
                    {
                        TestInformation testInformation = (TestInformation)dataRow["TestInformation"];
                        testInformation.Debug = false;

                        testInformation.TestState         = TestState.None;
                        testInformation.FailureMessage    = "";
                        testInformation.FailureStackTrace = "";
                        testInformation.Time = TimeSpan.Zero;
                        dataRow["Success"]   = testInformation.TestState;
                        dataRow["Time"]      = "";
                        dataRow["Message"]   = testInformation.FailureMessage;

                        testsToRun.Enqueue(testInformation);
                    }
                }
                if (testsToRun.Count > 0)
                {
                    testsToRunStartCount = testsToRun.Count;
                    currentTest          = testsToRun.Dequeue();
                    runTestsButton.Text  = "Stop";
                    runTestsButton.Image = stopIcon;
                    NunitManager.PreRunTestCase(currentTest);
                    testRunWorker.RunWorkerAsync();
                }
            }
            else
            {
                testsToRun.Clear();
                testsToRunStartCount = 1;
                NunitManager.AbortTestCase(currentTest);
            }
        }