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"); }
/// <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); }