private void lblExportExcel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var testScriptList = listViewTestScripts.Items.Cast <ListViewItem>().Select(x => x.Tag as TestScript).ToList(); RCRunnerAPI.ExportToExcel("result.xlsx", testScriptList); MessageBox.Show(@"Results exported to " + @"result.xlsx"); }
public FrmMain() { InitializeComponent(); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; // ReSharper disable once DoNotCallOverridableMethodsInConstructor Text = String.Format("RC Test Script Runner version {0}", version); _pluginLoader = new PluginLoader(); LoadTestRunners(); _pluginLoader.LoadTestExecutionPlugins(); _rcRunner = new RCRunnerAPI(); _rcRunner.MethodStatusChanged += OnMethodStatusChanged; lblFailedScripts.ForeColor = _testFailed; lblPassedScripts.ForeColor = _testPassed; lblRunningScripts.ForeColor = _testRunning; lblWatingScripts.ForeColor = _testWaiting; cmbxFilter.Items.Clear(); cmbxFilter.Items.Add("Everything"); cmbxFilter.Items.Add(TestExecutionStatus.Active); cmbxFilter.Items.Add(TestExecutionStatus.Failed); cmbxFilter.Items.Add(TestExecutionStatus.Passed); cmbxFilter.Items.Add(TestExecutionStatus.Running); cmbxFilter.Items.Add(TestExecutionStatus.Waiting); cmbxFilter.Items.Add(TestExecutionStatus.WillRetry); cmbxFilter.SelectedIndex = 0; ResetTestExecution(); DisableOrEnableControls(true); }
static Program() { PluginLoader = new PluginLoader(); RCRunnerAPI = new RCRunnerAPI { MethodStatusChanged = OnMethodStatusChanged }; Options = new Options(); }
/// <summary> /// Called after a test run finishes, this method will send an e-mail alerting that the run finished with some details about the test execution /// </summary> /// <param name="testCasesList"></param> public override void AfterTestRun(List <TestScript> testCasesList) { var passedTestCases = testCasesList.Count(x => x.TestExecutionStatus == TestExecutionStatus.Passed); var failedTestCases = testCasesList.Count(x => x.TestExecutionStatus == TestExecutionStatus.Failed); var message = string.Format( "{0} - The test execution finished. Ran {1} tests. {2} tests passed, {3} tests failed. More details on the spreedsheet", DateTime.Now, testCasesList.Count, passedTestCases, failedTestCases); var excelFilePath = Path.ChangeExtension(Path.GetTempFileName(), "xlsx"); RCRunnerAPI.ExportToExcel(excelFilePath, testCasesList); SendEmail(excelFilePath, message); }