本文整理汇总了C#中TestResult.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TestResult.ToString方法的具体用法?C# TestResult.ToString怎么用?C# TestResult.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestResult
的用法示例。
在下文中一共展示了TestResult.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddResult
public void AddResult (Test test, TestResult result)
{
XmlElement el = document.CreateElement ("Test");
string result_file = GetFilePath (test.ResultFile);
string master_file = GetFilePath (test.MasterFile);
CopyImageToRunDirectory (test_run_dir,result_file);
el.SetAttribute ("Id", test.Id);
el.SetAttribute ("InputFile", test.InputFile);
el.SetAttribute ("ResultFile", MakeRelativePath (result_file));
el.SetAttribute ("MasterFile", Path.GetFullPath (master_file));
el.SetAttribute ("TestResult", result.ToString ());
foreach (string category in test.Categories) {
XmlElement cat = document.CreateElement ("Category");
cat.SetAttribute ("Name", category);
el.AppendChild (cat);
}
runs_node.AppendChild (el);
UpdateRunsNode ();
SaveDocument ();
}
示例2: EndTest
///
/// <summary>
/// Ends the specified test with the specified test result.
/// </summary>
/// <param name="testId">Test id</param>
/// <param name="result">Result of the Test</param>
///
public void EndTest(string testId, TestResult result )
{
Console.ForegroundColor = NOTE_FG_COLOR;
if (result == TestResult.FAIL)
{
Console.ForegroundColor = ERROR_FG_COLOR;
}
StringBuilder sBuilder = new StringBuilder("[END] Test: ");
sBuilder.Append( testId );
sBuilder.Append( " RESULT: " );
sBuilder.Append( result.ToString() );
Console.WriteLine( sBuilder.ToString() );
Console.ForegroundColor = m_prevFGColor;
return;
}
示例3: EndTest
///
/// <summary>
/// Ends the specified test with the specified test result
/// </summary>
/// <param name="testId">Test id</param>
/// <param name="result">Result of the Test</param>
///
public void EndTest(
string testId,
TestResult result)
{
StringBuilder sBuilder = new StringBuilder("[END] Test: ");
sBuilder.Append(testId);
sBuilder.Append(" RESULT: ");
sBuilder.Append(result.ToString());
m_file.WriteLine(sBuilder.ToString());
m_file.Flush();
return;
}
示例4: reportResult
/// <summary>
/// Reports a test result to the test run listener. Must be called when a individual test
/// result has been fully parsed.
/// </summary>
/// <param name="statusMap"> key-value status pairs of test result </param>
private void reportResult(TestResult testInfo)
{
if (!testInfo.complete)
{
Log.w(LOG_TAG, "invalid instrumentation status bundle " + testInfo.ToString());
return;
}
reportTestRunStarted(testInfo);
TestIdentifier testId = new TestIdentifier(testInfo.mTestClass, testInfo.mTestName);
IDictionary<string, string> metrics;
switch (testInfo.mCode)
{
case StatusCodes.START:
foreach (ITestRunListener listener in mTestListeners)
{
listener.testStarted(testId);
}
break;
case StatusCodes.FAILURE:
metrics = andResetTestMetrics;
foreach (ITestRunListener listener in mTestListeners)
{
listener.testFailed(TestFailure.FAILURE, testId, getTrace(testInfo));
listener.testEnded(testId, metrics);
}
mNumTestsRun++;
break;
case StatusCodes.ERROR:
metrics = andResetTestMetrics;
foreach (ITestRunListener listener in mTestListeners)
{
listener.testFailed(TestFailure.ERROR, testId, getTrace(testInfo));
listener.testEnded(testId, metrics);
}
mNumTestsRun++;
break;
case StatusCodes.OK:
metrics = andResetTestMetrics;
foreach (ITestRunListener listener in mTestListeners)
{
listener.testEnded(testId, metrics);
}
mNumTestsRun++;
break;
default:
metrics = andResetTestMetrics;
Log.e(LOG_TAG, "Unknown status code received: " + testInfo.mCode);
foreach (ITestRunListener listener in mTestListeners)
{
listener.testEnded(testId, metrics);
}
mNumTestsRun++;
break;
}
}
示例5: WriteResult
private void WriteResult(TestResult result, ExceptionDetails exception)
{
if (result != TestResult.Passed && exception != null)
{
this.writer.WriteStartElement("Compare");
this.writer.WriteAttributeString("Message", exception.Message);
#if !SILVERLIGHT
if (!string.IsNullOrEmpty(exception.Source))
{
this.writer.WriteAttributeString("Source", exception.Source);
}
#endif
this.writer.WriteStartElement("Details");
this.writer.WriteCData(this.ExceptionFormatter(exception));
this.writer.WriteEndElement(); // Details
this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
this.writer.WriteEndElement(); // Compare
}
this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
}
示例6: WriteResult
private void WriteResult(TestItemData testItem, TestResult result, ExceptionDetails exception)
{
if (exception != null)
{
this.WriteStatusText(LogLevel.Error, this.currentIndentLevel, this.ExceptionFormatter(exception));
}
this.Unindent();
this.WriteStatusText(LogLevel.Info, this.currentIndentLevel, string.Format(CultureInfo.InvariantCulture, "{0} '{1}' {2}", this.GetItemTypeName(testItem), testItem.Metadata.Description, result.ToString()));
}
示例7: AddResult
public void AddResult(Test test, TestResult result)
{
if (!HasConnection) {
return;
}
AddTags(test);
string info = string.Empty;
string testname = test.InputFileName.Split('.')[0];
string masterfile = Path.Combine(masters, Path.GetFileName(test.MasterFile));
string renderfile = Path.Combine(runtime, Path.GetFileName(test.ResultFile));
string result_file = XmlReport.GetFilePath (test.ResultFile);
string master_file = XmlReport.GetFilePath (test.MasterFile);
//Log("masterfile = " + masterfile);
//Log("renderfile = " + renderfile);
//Log("result_file = " + result_file);
//Log("master_file = " + master_file);
XmlReport.CopyImageToRunDirectory(test_run_dir,result_file);
XmlReport.CopyImageToRunDirectory(Path.Combine("test-run-data",masters), master_file);
if (masterfile.EndsWith("tif") || masterfile.EndsWith("tiff")) {
masterfile += ".png";
renderfile += ".png";
}
int internal_id = AddTestCase(test.Id,testname,masterfile,test_suite);
switch(result) {
case TestResult.Fail:
info = test.FailedReason;
break;
case TestResult.Ignore:
info = test.IgnoreReason;
break;
case TestResult.KnownFailure:
info = test.KnownFailureReason;
break;
default:
info = string.Empty;
break;
}
string query = string.Format("INSERT INTO results (internal_id,runtimeid,result,renderfile,info) VALUES ('{0}','{1}','{2}','{3}', '{4}');",internal_id, runtimeid, result.ToString(), renderfile, info);
execnonquery(query);
}