private void m_bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = sender as BackgroundWorker; AutoTestParams param = e.Argument as AutoTestParams; AutoTestProgressInfo pi = new AutoTestProgressInfo(); TestClassCollection colTests = new TestClassCollection(); colTests.OnRunCompleted += colTests_OnRunCompleted; colTests.Load(param.TestDllFile); if (param.ResetAllTests) { colTests.ResetAllTests(); } else { colTests.LoadFromDatabase(); } try { colTests.Run(m_evtCancel, false, true, param.GpuId, param.ImageDbVersion, param.CudaPath); TestingProgressGet progress = new TestingProgressGet(); string strLast = null; while (!bw.CancellationPending && colTests.IsRunning) { Thread.Sleep(1000); string strCurrent = colTests.CurrentTest; double?dfProgress = progress.GetProgress(); if (strCurrent.Length > 0) { strCurrent = " [" + strCurrent + "]"; } if (dfProgress.HasValue) { strCurrent += " (" + dfProgress.Value.ToString("P") + " of current item)"; } pi.Set(colTests.PercentComplete, colTests.TotalTestTimingString + " completed " + colTests.TotalTestRunCount.ToString("N0") + " of " + colTests.TotalTestCount.ToString("N0") + " (" + colTests.TotalTestFailureCount.ToString("N0") + " failed)." + strCurrent); bw.ReportProgress((int)(pi.Progress * 100), pi); strLast = strCurrent; } } catch (Exception excpt) { pi.Set(excpt); bw.ReportProgress((int)(pi.Progress * 100), pi); } colTests.SaveToDatabase(); }
private void btnRun_Click(object sender, EventArgs e) { btnRun.Enabled = false; btnAbort.Enabled = true; string[] rgstr = m_rgTestClasses.GetEnabledMethods(); Trace.WriteLine("Running the following enabled tests..."); foreach (string str in rgstr) { Trace.WriteLine(" " + str); } m_rgTestClasses.Run(m_evtCancel, m_bSkip, false); m_bSkip = false; }
private void m_bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = sender as BackgroundWorker; AutoTestParams param = e.Argument as AutoTestParams; AutoTestProgressInfo pi = new AutoTestProgressInfo(); TestClassCollection colTests = new TestClassCollection(); colTests.OnRunCompleted += colTests_OnRunCompleted; colTests.Load(param.TestDllFile); if (param.ResetAllTests) { colTests.ResetAllTests(); } else { colTests.LoadFromDatabase(); } colTests.Run(m_evtCancel, false, true); while (!bw.CancellationPending && colTests.IsRunning) { Thread.Sleep(1000); string strCurrent = colTests.CurrentTest; if (strCurrent.Length > 0) { strCurrent = " [" + strCurrent + "]"; } pi.Set(colTests.PercentComplete, colTests.TotalTestTimingString + " completed " + colTests.TotalTestRunCount.ToString("N0") + " of " + colTests.TotalTestCount.ToString("N0") + " (" + colTests.TotalTestFailureCount.ToString("N0") + " failed)." + strCurrent); bw.ReportProgress((int)(pi.Progress * 100), pi); } colTests.SaveToDatabase(); }