/// <summary> /// Writes failure information if iteration failed /// </summary> /// <param name="Result">failed result incl any exceptionh</param> private void writeFailureMessage(TestMethodInvokerResult Result) { m_resultStringBuilder.AppendLine("failed"); Exception ex = Result.Exception; while (ex.InnerException != null) { ex = ex.InnerException; } m_resultStringBuilder.AppendLine(ex.Message); }
/// <summary> /// Gets the full run results to return to the client /// </summary> /// <returns>TestMethodInvokerResult to return to client</returns> public TestMethodInvokerResult GetAllResults() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Tested {0} rows \n\n", m_rowCount); sb.AppendLine(); sb.Append(m_resultStringBuilder.ToString()); TestMethodInvokerResult tmir = new TestMethodInvokerResult(); tmir.ExtensionResult = sb.ToString(); if (m_hasTestFailures) tmir.Exception = new Exception("see test details"); return tmir; }
/// <summary> /// Writes the result of the iteration to the results string builder /// </summary> /// <param name="Result">The result for this iteration</param> private void writeTestOutcome(TestMethodInvokerResult Result) { m_resultStringBuilder.Append("Outcome: "); if (Result.Exception != null) { m_hasTestFailures = true; writeFailureMessage(Result); } else { m_resultStringBuilder.AppendLine("passed"); } m_resultStringBuilder.AppendLine("--------------------------"); m_resultStringBuilder.AppendLine(); return; }
/// <summary> /// Gets the full run results to return to the client /// </summary> /// <returns>TestMethodInvokerResult to return to client</returns> public TestMethodInvokerResult GetAllResults() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Tested {0} rows \n\n", m_rowCount); sb.AppendLine(); sb.Append(m_resultStringBuilder.ToString()); TestMethodInvokerResult tmir = new TestMethodInvokerResult(); tmir.ExtensionResult = sb.ToString(); if (m_hasTestFailures) { tmir.Exception = new Exception("see test details"); } return(tmir); }
/// <summary> /// Gets the full run results to return to the client /// </summary> /// <returns>TestMethodInvokerResult to return to client</returns> public TestMethodInvokerResult GetAllResults() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Tested {0} rows \n\n", this.rowCount); sb.AppendLine(); sb.Append(this.resultStringBuilder.ToString()); // This is the results that will be included in the .trx <ExtensionResult> element for the TestMethod // (i.e. all the row results are in it) TestMethodInvokerResult tmir = new TestMethodInvokerResult(); tmir.ExtensionResult = sb.ToString(); if (this.hasTestFailures) { tmir.Exception = new Exception("see test details"); } return tmir; }
public void Add(ParametersAttribute testCase, TestMethodInvokerResult testResult) { _testCount ++; var parameters = string.Join(",", testCase.Parameters); var signature = string.Format("{0}({1})", _methodName, parameters); if (testResult.Exception == null) { _message.AppendLine(); _message.AppendFormat("{0}: Passed", signature); _message.AppendLine(); } else { _hasFailed = true; var exception = GetExceptionMessage(testResult.Exception); _message.AppendLine(); _message.AppendFormat("{0}: Failed. {1}", signature, exception); _message.AppendLine(); } }
/// <summary> /// Adds a result to the list of results we have /// </summary> /// <param name="Result">The result of the iteraiton</param> /// <param name="RowValues">Row Values that were used for the iteraiton</param> public void AddTestResult(TestMethodInvokerResult Result, object[] RowValues) { m_rowCount++; writeResultHeader(RowValues); writeTestOutcome(Result); }