public static TestStepResult WithDetails(this TestStepResult result, string statusDetails) { result.StatusDetails = statusDetails; return(result); }
/// <summary> /// Constructor /// </summary> /// <param name="strStatus">The current progress status</param> /// <param name="strTitle">The title of the progress status</param> /// <param name="result">The result of the test step.</param> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 08/28/09 RCG 2.30.00 Created public TestStepEventArgs(string strStatus, string strTitle, TestStepResult result) : base(strStatus) { m_Result = result; m_strTitle = strTitle; }
public static TestStepResult WithComments(this TestStepResult result, params string[] comments) { result.Comments = comments; return(result); }
public TestStepResult Do() { return(TestStepResult.Successful()); }
public override void OnTestStepExecutionComplete(TestStep testStep, TestStepResult testStepResult) { Debug.WriteLine("ExampleListener method: " + MethodInfo.GetCurrentMethod().Name); }
/// <summary> /// Runs the validation tests. /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 08/28/09 RCG 2.30.00 Created // 04/09/13 jrf 3.50.69 458134 Adding handler for the ValidationTest's FatalErrorEvent. public void RunValidationTests() { TestResults CurrentResults = new TestResults(); TestRun CurrentTestRun = new TestRun(); List <ValidationTest> SelectedTests = null; TestStepResult PreviousStepResult = TestStepResult.None; string[] SplitMeterID; string strTitle = ""; string strMeterID = ""; m_bCancelled = false; OnShowProgressEvent(new ShowProgressEventArgs(1, StepCount, m_strName, Resources.StatusRetrievingDeviceInfo)); try { // Open the communications port for the duration of the test. m_Comm.OpenPort(m_strPort); // Get the basic device information from the meter. CurrentTestRun = GetDeviceInfo(); SelectedTests = GetSelectedTests(); // Since we are using the ESN for meter ID we need to trim it down to a // reasonable identifier for use in the status and file name SplitMeterID = CurrentTestRun.MeterID.Split('.'); if (SplitMeterID.Length > 0) { strMeterID = SplitMeterID[SplitMeterID.Length - 1]; } strTitle = m_strName + " - " + strMeterID; m_strResultFile = m_strResultDir + strMeterID + " " + CurrentTestRun.TestDate.ToString("MMddyyyyhhmmss", CultureInfo.CurrentCulture) + ".xml"; // Run each of the tests foreach (ValidationTest CurrentTest in SelectedTests) { Test TestResult = null; OnStepProgressEvent(new TestStepEventArgs(Resources.StatusRunningTest + CurrentTest.TestName + "...", strTitle, PreviousStepResult)); if (m_bCancelled == false) { m_RunningTest = CurrentTest; m_RunningTest.FatalErrorEvent += new FatalErrorEventHandler(HandleFatalError); try { TestResult = CurrentTest.RunTest(); } catch (Exception e) { TestResult = new Test(); TestResult.Name = CurrentTest.TestName; TestResult.Reason = Resources.ReasonExceptionOccurred + e.Message; TestResult.Result = Resources.Failed; } m_RunningTest = null; } else { TestResult = new Test(); TestResult.Name = CurrentTest.TestName; TestResult.Result = Resources.Skipped; TestResult.Reason = Resources.Cancelled; } PreviousStepResult = GetStepResult(TestResult); CurrentTestRun.Tests.Add(TestResult); } m_Comm.ClosePort(); OnStepProgressEvent(new TestStepEventArgs(Resources.StatusSavingResults, strTitle, PreviousStepResult)); // Save the results CurrentResults.TestRuns.Add(CurrentTestRun); CurrentResults.SaveAs(m_strResultFile); if (m_bCancelled == false) { OnHideProgressEvent(new TestCompleteEventArgs(Resources.StatusComplete, m_strResultFile)); } else { OnHideProgressEvent(new TestCompleteEventArgs(Resources.Cancelled, m_strResultFile)); } } catch (ThreadAbortException) { // The thread was killed no need to display an error if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } } catch (PSEMException e) { // An error occurred while running the tests so we should notify the user. if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } ErrorForm.DisplayError(m_strName + " - " + "A protocol error occurred: " + e.PSEMResponse.ToDescription(), e); OnHideProgressEvent(new TestCompleteEventArgs(Resources.FailedExceptionOccurred, null)); } catch (Exception e) { // An error occurred while running the tests so we should notify the user. if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } ErrorForm.DisplayError(m_strName + " - " + e.Message, e); OnHideProgressEvent(new TestCompleteEventArgs(Resources.FailedExceptionOccurred, null)); } }
public void Cleanup(TestStepResult result) { }
private bool Do(Point point, bool suppressExceptionsIntoResult, TestState testState) { foreach (var step in point.TestSteps) { point.RunOk = true; if (!suppressExceptionsIntoResult) { testState = ExecuteTestStep(point, step, testState); } else { try { testState = ExecuteTestStep(point, step, testState); } catch (Exception e) { step.Result = e is TestCaseException?TestStepResult.Failed(e.Message) : TestStepResult.ImplementationError(e); step.Result.RefToScreenshot = ErrorCollector.GetReferenceToAttachmentIfApplicable(testState); step.Result.SetException(e); point.RunOk = false; break; } } if (!step.Result.Success) { step.Result.RefToScreenshot = ErrorCollector.GetReferenceToAttachmentIfApplicable(testState); point.RunOk = false; break; } } bool cleanupSucceeded = true; for (var i = point.TestSteps.Count - 1; i >= 0; i--) { var step = point.TestSteps[i]; try { CleanupTestStep(point, step, testState); } catch (Exception e) { Log.Info($"Cleanup Failed for Point {point.Id} in Step {step.StepIndex}: {e.Message}"); cleanupSucceeded = false; } } return(cleanupSucceeded); }
private static void TestStep_OnExecutionComplete(TestStep testStep, TestStepResult testStepResult) { LogEvent.Info(message: $"Test step execution \"{testStep.Title}\" completed ({testStepResult.TestVerdict})."); }
public override void OnTestStepExecutionComplete(TestStep testStep, TestStepResult testStepResult) { }
public abstract void OnTestStepExecutionComplete(TestStep testStep, TestStepResult testStepResult);
public override void Cleanup(TestStepResult result) { }
public override void OnTestStepExecutionComplete(TestStep testStep, TestStepResult testStepResult) { formatResult(getExtentTest(testStep.SystemID), testStep, testStepResult); }
public void PostResultTestRail() { try { _qvizClient.Authenticate(QVizUser, QVizPassword); var project = _qvizClient.GetProject(QVizProject); var testCases = _qvizClient.GetGUITestCases(project.projectId); if (testCases.Count > 0) { var testCase = testCases.First(); var guiResult = new GUITestResult { testResult = { testCaseId = testCase.testCaseId, moduleId = testCase.moduleId, subModuleId = testCase.subModuleId, status = "Pass", sUT = project.projectName, releaseName = "Version 1.0.0", releaseNo = "1.0.0", sprintName = "UBI Sprint 1", sprintNo = "UBI-1", buildVersion = "1.0.0", browserName = "ChromeDriver", browserVersion = "2.46", resolution = "1920x1080", oSName = "Windows 10 Professional", oSVersion = "1903", appType = "Angular 8 Application", appVersion = "1.0.0", executionStartTime = DateTime.Now, projectId = project.projectId, environment = "Cloud", runID = "SDK-Unit-Test" } }; foreach (var testStep in testCase.testCaseSteps) { var stepResult = new TestStepResult { testCaseStepId = testStep.testCaseStepId, status = "Pass", actualResult = testStep.expectedResult, executionStartTime = DateTime.Now, executionEndTime = DateTime.Now }; guiResult.testResult.testStepResults.Add(stepResult); } guiResult.testResult.executionEndTime = DateTime.Now; try { var testRail = _qvizClient.GetToolConfiguration <ToolTestRail>( project.projectId, "TESTRAIL" ); _qvizClient.SendTestResultsToTestRail( guiResult, testRail.url, testRail.userName, testRail.password, "10", "" ); } catch (Exception) { // Does not contain configurations for TestRail } Assert.AreEqual("Pass", guiResult.testResult.status); } else { throw new Exception("There are NO GUI Test Cases available in the Project (" + QVizProject + ")."); } } catch (Exception error) { Assert.Fail(error.Message); } }
public void PostGUITestResult() { try { _qvizClient.Authenticate(QVizUser, QVizPassword); var project = _qvizClient.GetProject(QVizProject); var testCases = _qvizClient.GetGUITestCases(project.projectId); if (testCases.Count > 0) { var testCase = testCases.FirstOrDefault(f => f.testCaseSteps.Count >= 4); var guiResult = new GUITestResult { testResult = { testCaseId = testCase.testCaseId, moduleId = testCase.moduleId, subModuleId = testCase.subModuleId, actualResult = "Error1 Message should be correct for all fields of B.I. Worksheet sheet in Export excel file", status = "Pass", error = "", errorScreen = "", sUT = project.projectName, releaseName = "Release 9", releaseNo = "8.0.0", sprintName = "P&C Sprint 8", sprintNo = "PC-8", buildVersion = "33004", browserName = "chrome", browserVersion = "78.0.3904", resolution = "1920x1080", oSName = "Windows 10 Professional", oSVersion = "1903", appType = "ReactJS Application", appVersion = "7.29002", executionStartTime = DateTime.Now, //Convert.ToDateTime("2020-06-30T17:35:33.512"), executionEndTime = DateTime.Now, projectId = testCase.projectId, environment = "QA", runID = "SDK-Unit-Test" + DateTime.Now, } }; var testSteps = testCase.testCaseSteps; //foreach (var testStep in testCase.testCaseSteps) //{ var stepResult1 = new TestStepResult { testCaseStepId = testSteps[0].testCaseStepId, actualResult = "Error message should be correct for Annual Net Profit/(Net Loss) Before Tax cell", screenshotURL = "", status = "Pass", error = "", executionStartTime = Convert.ToDateTime("2020-06-30T17:35:36.577"), executionEndTime = Convert.ToDateTime("2020-06-30T17:35:40.793") }; guiResult.testResult.testStepResults.Add(stepResult1); var stepResult2 = new TestStepResult { testCaseStepId = testSteps[1].testCaseStepId, actualResult = "Error message should be correct for Annual Continuing Expenses cell", screenshotURL = "", status = "Pass", error = "", executionStartTime = Convert.ToDateTime("2020-06-30T17:35:42.793"), executionEndTime = Convert.ToDateTime("2020-06-30T17:35:43.153") }; guiResult.testResult.testStepResults.Add(stepResult2); var stepResult3 = new TestStepResult { testCaseStepId = testSteps[2].testCaseStepId, actualResult = "Error message should be correct for What is (in number of months) the amount of time needed to operate at 100% in the event of a total loss?", screenshotURL = "", status = "Pass", error = "", executionStartTime = Convert.ToDateTime("2020-06-30T17:35:45.154"), executionEndTime = Convert.ToDateTime("2020-06-30T17:35:45.481") }; guiResult.testResult.testStepResults.Add(stepResult3); var stepResult4 = new TestStepResult { testCaseStepId = testSteps[3].testCaseStepId, actualResult = "Error message should be correct for Extra Expense cell", screenshotURL = "", status = "Pass", error = "", executionStartTime = Convert.ToDateTime("2020-06-30T17:35:47.496"), executionEndTime = Convert.ToDateTime("2020-06-30T17:35:47.800") }; guiResult.testResult.testStepResults.Add(stepResult4); _qvizClient.PostGUITestResults(guiResult); Assert.AreEqual("Pass", guiResult.testResult.status); } else { throw new Exception("There are NO GUI Test Cases available in the Project (" + QVizProject + ")."); } } catch (Exception error) { Assert.Fail(error.Message); } }
public override void OnTestStepExecutionComplete(TestStep testStep, TestStepResult testStepResult) { throw new NotImplementedException(); }